DateTimeFormatter.OfLocalizedTime(FormatStyle) 方法

定义

返回 ISO 时间顺序的区域设置特定时间格式。

[Android.Runtime.Register("ofLocalizedTime", "(Ljava/time/format/FormatStyle;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)]
public static Java.Time.Format.DateTimeFormatter? OfLocalizedTime(Java.Time.Format.FormatStyle? timeStyle);
[<Android.Runtime.Register("ofLocalizedTime", "(Ljava/time/format/FormatStyle;)Ljava/time/format/DateTimeFormatter;", "", ApiSince=26)>]
static member OfLocalizedTime : Java.Time.Format.FormatStyle -> Java.Time.Format.DateTimeFormatter

参数

timeStyle
FormatStyle

要获取的格式化程序样式,而不是 null

返回

时间格式化程序,而不是 null

属性

注解

返回 ISO 时间顺序的区域设置特定时间格式。

这会返回一个格式化程序,它将格式化或分析时间。 使用的确切格式模式因区域设置而异。

区域设置由格式化程序确定。 此方法直接返回的格式化程序将使用 .Locale#getDefault(Locale.Category) default FORMAT locale 可以使用此方法的结果控制 DateTimeFormatter#withLocale(Locale) withLocale(Locale) 区域设置。

请注意,本地化模式的查找迟缓。 这会 DateTimeFormatter 保留所需的样式和区域设置,并按需查找所需的模式。

返回的格式化程序具有 ISO 的计时表,以确保正确转换其他日历系统中的日期。 它没有替代区域,并且使用 ResolverStyle#SMART SMART 解析程序样式。 样式FULLLONG通常需要时区。 使用这些样式进行格式设置时,ZoneIdZonedDateTime必须使用或 DateTimeFormatter#withZone.

Java文档java.time.format.DateTimeFormatter.ofLocalizedTime(java.time.format.FormatStyle)

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

适用于