语言

DateTimeFormatterBuilder.AppendLocalized 方法

定义

重载

名称 说明
AppendLocalized(String)

使用请求的模板将本地化模式追加到格式化程序。

AppendLocalized(FormatStyle, FormatStyle)

将本地化的日期时间模式追加到格式化程序。

AppendLocalized(String)

使用请求的模板将本地化模式追加到格式化程序。

[Android.Runtime.Register("appendLocalized", "(Ljava/lang/String;)Ljava/time/format/DateTimeFormatterBuilder;", "", ApiSince=37)]
public Java.Time.Format.DateTimeFormatterBuilder AppendLocalized(string requestedTemplate);
[<Android.Runtime.Register("appendLocalized", "(Ljava/lang/String;)Ljava/time/format/DateTimeFormatterBuilder;", "", ApiSince=37)>]
member this.AppendLocalized : string -> Java.Time.Format.DateTimeFormatterBuilder

参数

requestedTemplate
String

要使用的请求的模板,而不是 null

返回

此操作用于链接,而不是 null

特性

注解

使用请求的模板将本地化模式追加到格式化程序。 这会将本地化部分追加到生成器,适合输出日期、时间或日期时间组合。 本地化部分的格式基于三个项目进行延迟查找:为此方法指定的 requestedTemplate;DateTimeFormatter 的区域设置;DateTimeFormatter 的计时,除非重写。 在格式设置过程中,从格式化的临时对象中获取计时表,该对象可能已被 DateTimeFormatter.withChronology(Chronology)重写。 在分析期间,如果已分析计时表,则使用它。 否则,将使用 DateTimeFormatter.withChronology(Chronology)中的默认值,将 IsoChronology 用作回退。

请求的模板是一系列典型的模式符号,按规范顺序从最大日期或时间单位到最小,可以使用以下正则表达式表示:

"G{0,5}" +        // Era
"y*" +            // Year
"Q{0,5}" +        // Quarter
"M{0,5}" +        // Month
"w*" +            // Week of Week Based Year
"E{0,5}" +        // Day of Week
"d{0,2}" +        // Day of Month
"B{0,5}" +        // Period/AmPm of Day
"[hHjC]{0,2}" +   // Hour of Day/AmPm (refer to LDML for 'j' and 'C')
"m{0,2}" +        // Minute of Hour
"s{0,2}" +        // Second of Minute
"[vz]{0,4}"       // Zone

所有模式符号都是可选的,每个模式符号表示一个字段,例如,“M”表示 Month 字段。 图案符号字母的数量遵循相同的演示文稿,如“number”或“text”,如“格式设置和分析”部分中的 DateTimeFormatter模式。 请求的模板中的其他模式符号无效。

Java参考java.time.format.DateTimeFormatterBuilder.appendLocalized。

适用于

AppendLocalized(FormatStyle, FormatStyle)

将本地化的日期时间模式追加到格式化程序。

[Android.Runtime.Register("appendLocalized", "(Ljava/time/format/FormatStyle;Ljava/time/format/FormatStyle;)Ljava/time/format/DateTimeFormatterBuilder;", "", ApiSince=26)]
public Java.Time.Format.DateTimeFormatterBuilder? AppendLocalized(Java.Time.Format.FormatStyle? dateStyle, Java.Time.Format.FormatStyle? timeStyle);
[<Android.Runtime.Register("appendLocalized", "(Ljava/time/format/FormatStyle;Ljava/time/format/FormatStyle;)Ljava/time/format/DateTimeFormatterBuilder;", "", ApiSince=26)>]
member this.AppendLocalized : Java.Time.Format.FormatStyle * Java.Time.Format.FormatStyle -> Java.Time.Format.DateTimeFormatterBuilder

参数

dateStyle
FormatStyle

要使用的日期样式,null 表示不需要日期

timeStyle
FormatStyle

要使用的时间样式,null 表示不需要时间

返回

此操作用于链接,而不是 null

特性

注解

Java文档java.time.format.DateTimeFormatterBuilder.appendLocalized(java.time.format.FormatStyle, java.time.format.FormatStyle)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于