语言

OffsetDateTime.Parse 方法

定义

重载

名称 说明
Parse(ICharSequence)

从文本字符串(如 2007-12-03T10:15:30+01:00)获取 OffsetDateTime 的实例。

Parse(String)

使用与字符串的 UTC 偏移量分析 ISO 日期和时间。

Parse(ICharSequence, DateTimeFormatter)

使用特定格式化程序从文本字符串中获取 OffsetDateTime 的实例。

Parse(String, DateTimeFormatter)

使用指定的格式化程序分析偏移日期时间字符串。

Parse(ICharSequence)

从文本字符串(如 2007-12-03T10:15:30+01:00)获取 OffsetDateTime 的实例。

[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/OffsetDateTime;", "", ApiSince=26)]
public static Java.Time.OffsetDateTime? Parse(Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/OffsetDateTime;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence -> Java.Time.OffsetDateTime

参数

text
ICharSequence

要分析的文本,例如“2007-12-03T10:15:30+01:00”,而不是 null

返回

分析的偏移日期时间,而不是 null

特性

注解

从文本字符串(如 2007-12-03T10:15:30+01:00)获取 OffsetDateTime 的实例。 字符串必须表示有效的日期时间,并使用 DateTimeFormatter.ISO_OFFSET_DATE_TIME 进行分析。

Java参考java.time.OffsetDateTime.parse。

适用于

Parse(String)

使用与字符串的 UTC 偏移量分析 ISO 日期和时间。

public static Java.Time.OffsetDateTime? Parse(string? text);
static member Parse : string -> Java.Time.OffsetDateTime

参数

text
String

日期时间和偏移文本,例如 2007-12-03T10:15:30+01:00。

返回

从 text中读取的日期、时间和偏移量。

注解

此字符串重载调用 Parse(ICharSequence) 和使用 IsoOffsetDateTime。

适用于

Parse(ICharSequence, DateTimeFormatter)

使用特定格式化程序从文本字符串中获取 OffsetDateTime 的实例。

[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/OffsetDateTime;", "", ApiSince=26)]
public static Java.Time.OffsetDateTime? Parse(Java.Lang.ICharSequence? text, Java.Time.Format.DateTimeFormatter? formatter);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/OffsetDateTime;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence * Java.Time.Format.DateTimeFormatter -> Java.Time.OffsetDateTime

参数

text
ICharSequence

要分析的文本,而不是 null

formatter
DateTimeFormatter

要使用的格式化程序,而不是 null

返回

分析的偏移日期时间,而不是 null

特性

注解

使用特定格式化程序从文本字符串中获取 OffsetDateTime 的实例。 使用格式化程序分析文本,并返回日期时间。

Java参考java.time.OffsetDateTime.parse。

适用于

Parse(String, DateTimeFormatter)

使用指定的格式化程序分析偏移日期时间字符串。

public static Java.Time.OffsetDateTime? Parse(string? text, Java.Time.Format.DateTimeFormatter? formatter);
static member Parse : string * Java.Time.Format.DateTimeFormatter -> Java.Time.OffsetDateTime

参数

text
String

包含日期、时间和偏移字段的字符串。

formatter
DateTimeFormatter

读取日期、时间和偏移字段的格式化程序。

返回

从 text中读取的日期、时间和偏移量。

注解

此字符串重载调用 Parse(ICharSequence, DateTimeFormatter)。 提供的格式化程序确定输入格式。

适用于