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 支援

適用於

另請參閱