Sdílet prostřednictvím


DateTimeFormatter.OfPattern Method

Definition

Overloads

OfPattern(String, Locale)

Creates a formatter using the specified pattern and locale.

OfPattern(String)

Creates a formatter using the specified pattern.

OfPattern(String, Locale)

Creates a formatter using the specified pattern and locale.

[Android.Runtime.Register("ofPattern", "(Ljava/lang/String;Ljava/util/Locale;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)]
public static Java.Time.Format.DateTimeFormatter? OfPattern (string? pattern, Java.Util.Locale? locale);
[<Android.Runtime.Register("ofPattern", "(Ljava/lang/String;Ljava/util/Locale;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)>]
static member OfPattern : string * Java.Util.Locale -> Java.Time.Format.DateTimeFormatter

Parameters

pattern
String

the pattern to use, not null

locale
Locale

the locale to use, not null

Returns

the formatter based on the pattern, not null

Attributes

Remarks

Creates a formatter using the specified pattern and locale.

This method will create a formatter based on a simple pattern of letters and symbols as described in the class documentation. For example, d MMM uuuu will format 2011-12-03 as '3 Dec 2011'.

The formatter will use the specified locale. This can be changed using DateTimeFormatter#withLocale(Locale) on the returned formatter.

The returned formatter has no override chronology or zone. It uses ResolverStyle#SMART SMART resolver style.

Java documentation for java.time.format.DateTimeFormatter.ofPattern(java.lang.String, java.util.Locale).

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

OfPattern(String)

Creates a formatter using the specified pattern.

[Android.Runtime.Register("ofPattern", "(Ljava/lang/String;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)]
public static Java.Time.Format.DateTimeFormatter? OfPattern (string? pattern);
[<Android.Runtime.Register("ofPattern", "(Ljava/lang/String;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)>]
static member OfPattern : string -> Java.Time.Format.DateTimeFormatter

Parameters

pattern
String

the pattern to use, not null

Returns

the formatter based on the pattern, not null

Attributes

Remarks

Creates a formatter using the specified pattern.

This method will create a formatter based on a simple pattern of letters and symbols as described in the class documentation. For example, d MMM uuuu will format 2011-12-03 as '3 Dec 2011'.

The formatter will use the Locale#getDefault(Locale.Category) default FORMAT locale. This can be changed using DateTimeFormatter#withLocale(Locale) on the returned formatter. Alternatively use the #ofPattern(String, Locale) variant of this method.

The returned formatter has no override chronology or zone. It uses ResolverStyle#SMART SMART resolver style.

Java documentation for java.time.format.DateTimeFormatter.ofPattern(java.lang.String).

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