OffsetTime.Parse 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| Parse(ICharSequence) |
从文本字符串(如 10:15:30+01:00)获取 OffsetTime 的实例。 |
| Parse(String) |
使用与字符串的 UTC 偏移量分析 ISO 时间。 |
| Parse(ICharSequence, DateTimeFormatter) |
使用特定格式化程序从文本字符串中获取 OffsetTime 的实例。 |
| Parse(String, DateTimeFormatter) |
使用指定的格式化程序分析偏移时间字符串。 |
Parse(ICharSequence)
从文本字符串(如 10:15:30+01:00)获取 OffsetTime 的实例。
[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/OffsetTime;", "", ApiSince=26)]
public static Java.Time.OffsetTime? Parse(Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/OffsetTime;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence -> Java.Time.OffsetTime
参数
- text
- ICharSequence
要分析的文本,例如“10:15:30+01:00”,而不是 null
返回
分析的本地时间,而不是 null
- 特性
注解
从文本字符串(如 10:15:30+01:00)获取 OffsetTime 的实例。 字符串必须表示有效的时间,并使用 DateTimeFormatter.ISO_OFFSET_TIME 进行分析。
Java参考java.time.OffsetTime.parse。
适用于
Parse(String)
使用与字符串的 UTC 偏移量分析 ISO 时间。
public static Java.Time.OffsetTime? Parse(string? text);
static member Parse : string -> Java.Time.OffsetTime
参数
- text
- String
时间和偏移文本,例如 10:15:30+01:00。
返回
从中读取 text的时间和偏移量。
注解
此字符串重载调用 Parse(ICharSequence) 和使用 IsoOffsetTime。
适用于
Parse(ICharSequence, DateTimeFormatter)
使用特定格式化程序从文本字符串中获取 OffsetTime 的实例。
[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/OffsetTime;", "", ApiSince=26)]
public static Java.Time.OffsetTime? Parse(Java.Lang.ICharSequence? text, Java.Time.Format.DateTimeFormatter? formatter);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/OffsetTime;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence * Java.Time.Format.DateTimeFormatter -> Java.Time.OffsetTime
参数
- text
- ICharSequence
要分析的文本,而不是 null
- formatter
- DateTimeFormatter
要使用的格式化程序,而不是 null
返回
分析的偏移时间,而不是 null
- 特性
注解
使用特定格式化程序从文本字符串中获取 OffsetTime 的实例。 使用格式化程序分析文本,并返回时间。
Java参考java.time.OffsetTime.parse。
适用于
Parse(String, DateTimeFormatter)
使用指定的格式化程序分析偏移时间字符串。
public static Java.Time.OffsetTime? Parse(string? text, Java.Time.Format.DateTimeFormatter? formatter);
static member Parse : string * Java.Time.Format.DateTimeFormatter -> Java.Time.OffsetTime
参数
- text
- String
包含时间和偏移字段的字符串。
- formatter
- DateTimeFormatter
读取时间和偏移字段的格式化程序。
返回
从中读取 text的时间和偏移量。
注解
此字符串重载调用 Parse(ICharSequence, DateTimeFormatter)。 提供的格式化程序确定输入格式。