System.JSON.Readers.TJsonReader.ReadAsDateTime

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ReadAsDateTime: TDateTime; virtual;

C++

virtual System::TDateTime __fastcall ReadAsDateTime();

Properties

Type Visibility Source Unit Parent
function public
System.JSON.Readers.pas
System.JSON.Readers.hpp
System.JSON.Readers TJsonReader

Description

Reads the next JSON token and interprets it as a DateTime value.

Instead of Read, you may alternatively use a different reading method if you can anticipate the type of the next token.

There is no standard for dates in JSON, so there are multiple possible formats of dates representation. Using ReadAsDateTime is a solution to read dates in JSON when you can anticipate the token type.

ReadAsDateTime function reads the next token and returns a TDateTime value. ReadAsDateTime calls ReadAsDateTimeInternal.

If the token cannot be interpreted as the expected type, an exception raises and provides the path to the token, the number of the line and the position within that line.

See Also