DateTimeFormatter.OfPattern 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| OfPattern(String, Locale) |
使用指定的模式和地點建立格式化器。 |
| OfPattern(String) |
使用指定的模式建立格式化器。 |
OfPattern(String, 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
參數
- pattern
- String
模式要用,不是空模式
- locale
- Locale
要使用的 locale,而非 null
傳回
格式化器是基於模式,而非 null
- 屬性
備註
使用指定的模式和地點建立格式化器。
此方法將根據類別文件中描述的簡單字母與符號模式,建立一個格式化器。 例如, d MMM uuuu 將 2011-12-03 格式化為「3 Dec 2011」。
格式化器會使用指定的地點。 這可以透過回傳格式化器來更改 DateTimeFormatter#withLocale(Locale) 。
回傳的格式化器沒有覆蓋的時間順序或區域。 它使用 ResolverStyle#SMART SMART 解析器風格。
Java 文件 java.time.format.DateTimeFormatter.ofPattern(java.lang.String, java.util.Locale)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
OfPattern(String)
使用指定的模式建立格式化器。
[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
參數
- pattern
- String
模式要用,不是空模式
傳回
格式化器是基於模式,而非 null
- 屬性
備註
使用指定的模式建立格式化器。
此方法將根據類別文件中描述的簡單字母與符號模式,建立一個格式化器。 例如, d MMM uuuu 將 2011-12-03 格式化為「3 Dec 2011」。
格式化器會使用 Locale#getDefault(Locale.Category) default FORMAT locale. 這可以透過回傳格式化器來更改 DateTimeFormatter#withLocale(Locale) 。 或者,也可以使用 #ofPattern(String, Locale) 此方法的變體。
回傳的格式化器沒有覆蓋的時間順序或區域。 它使用 ResolverStyle#SMART SMART 解析器風格。
Java 文件 java.time.format.DateTimeFormatter.ofPattern(java.lang.String)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。