System.DateUtils.DateToISO8601
Delphi
function DateToISO8601(const ADate: TDateTime; AInputIsUTC: Boolean = true): string;
C++
extern DELPHI_PACKAGE System::UnicodeString __fastcall DateToISO8601(const System::TDateTime ADate, bool AInputIsUTC = true);
Properties
| Type | Visibility | Source | Unit | Parent | 
|---|---|---|---|---|
| function | public | System.DateUtils.pas System.DateUtils.hpp  | 
        System.DateUtils | System.DateUtils | 
Description
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. 
ADateis a date-and-time value in the TDateTime format.
AInputIsUTCis a boolean defining whether the inputADatetime is specified in the UTC time zone. The default isTrue.- If 
AInputIsUTCisTrue, the resulting ISO 8601 string contains exactly the same time asADatehas, and contains theZ(Zulu) postfix.- For example, 
35065.75is converted into1996-01-01T18:00:00.000Z. 
 - For example, 
 - If 
AInputIsUTCisFalse, DateToISO8601 treats the inputADatetime 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. 
- If 
 
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.