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.
ADate
is a date-and-time value in the TDateTime format.
AInputIsUTC
is a boolean defining whether the inputADate
time is specified in the UTC time zone. The default isTrue
.- If
AInputIsUTC
isTrue
, the resulting ISO 8601 string contains exactly the same time asADate
has, and contains theZ
(Zulu) postfix.- For example,
35065.75
is converted into1996-01-01T18:00:00.000Z
.
- For example,
- If
AInputIsUTC
isFalse
, DateToISO8601 treats the inputADate
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.
- 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.