From RAD Studio API Documentation
Jump to: navigation, search


function DateToISO8601(const ADate: TDateTime; AInputIsUTC: Boolean = true): string;


extern DELPHI_PACKAGE System::UnicodeString __fastcall DateToISO8601(const System::TDateTime ADate, bool AInputIsUTC = true);


Type Visibility Source Unit Parent
function public
System.DateUtils System.DateUtils


Converts the ADate date-and-time value, specified in the TDateTime format, into a string containing a date-and-time value in the ISO 8601 format.

  • ADate is a date-and-time value in the TDateTime format.
  • AInputIsUTC is a boolean defining whether the input ADate time is specified in the UTC time zone. The default is True.
    • If AInputIsUTC is True, the resulting ISO 8601 string contains exactly the same time as ADate has, and contains the Z (Zulu) postfix.
      For example, 35065.75 is converted into 1996-01-01T18:00:00.000Z.
    • If AInputIsUTC is False, DateToISO8601 treats the input ADate time as a local time. Then the converted resulting ISO 8601 format time contains time offsets for the local time zone (locale) of the system running your application.

The following table demonstrates usage of AInputIsUTC. The input ADate date-and-time value, specified in the TDateTime format, is 35065.75. This example expects that the local time zone is (UTC-08:00) Pacific Time.

ADate AInputIsUTC ISO 8601 Result
35065.75 True 1996-01-01T18:00:00.000Z
35065.75 False 1996-01-01T18:00:00.000-08:00

Here -08:00 is the time offset for the (UTC-08:00) Pacific Time time zone.

See Also