Utf8JsonReader.GetDateTime 方法

定义

从源中读取下一个 JSON 令牌值并将其分析为一个 DateTime

public:
 DateTime GetDateTime();
public DateTime GetDateTime();
member this.GetDateTime : unit -> DateTime
Public Function GetDateTime () As DateTime

返回

如果可以成功分析整个 UTF-8 编码的令牌值,则日期和时间值。

例外

JSON 令牌的值不是 String

JSON 令牌值不能读取为 .DateTime

-或-

无法将整个 UTF-8 编码的令牌值分析为值 DateTime

-或-

JSON 令牌值的格式不受支持。

注解

此方法仅创建 DateTime 符合 ISO 8601-1 扩展格式的 JSON 字符串的表示形式(请参阅 System.Text.Json 中的 DateTime 和 DateTimeOffset 支持)。

适用于

另请参阅