다음을 통해 공유


DateTimeFormatter.WithResolverStyle(ResolverStyle) Method

Definition

Returns a copy of this formatter with a new resolver style.

[Android.Runtime.Register("withResolverStyle", "(Ljava/time/format/ResolverStyle;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)]
public Java.Time.Format.DateTimeFormatter? WithResolverStyle (Java.Time.Format.ResolverStyle? resolverStyle);
[<Android.Runtime.Register("withResolverStyle", "(Ljava/time/format/ResolverStyle;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)>]
member this.WithResolverStyle : Java.Time.Format.ResolverStyle -> Java.Time.Format.DateTimeFormatter

Parameters

resolverStyle
ResolverStyle

the new resolver style, not null

Returns

a formatter based on this formatter with the requested resolver style, not null

Attributes

Remarks

Returns a copy of this formatter with a new resolver style.

This returns a formatter with similar state to this formatter but with the resolver style set. By default, a formatter has the ResolverStyle#SMART SMART resolver style.

Changing the resolver style only has an effect during parsing. Parsing a text string occurs in two phases. Phase 1 is a basic text parse according to the fields added to the builder. Phase 2 resolves the parsed field-value pairs into date and/or time objects. The resolver style is used to control how phase 2, resolving, happens. See ResolverStyle for more information on the options available.

This instance is immutable and unaffected by this method call.

Java documentation for java.time.format.DateTimeFormatter.withResolverStyle(java.time.format.ResolverStyle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to