System.DateUtils.TryISO8601ToDate
Delphi
function TryISO8601ToDate(const AISODate: string; out Value: TDateTime; AReturnUTC: Boolean = True): Boolean;
C++
extern DELPHI_PACKAGE bool __fastcall TryISO8601ToDate(const System::UnicodeString AISODate, /* out */ System::TDateTime &Value, bool AReturnUTC = true);
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | public | System.DateUtils.pas System.DateUtils.hpp |
System.DateUtils | System.DateUtils |
Description
Tries to convert the provided date-and-time value, specified in the ISO 8601 format, into the date-and-time value in the TDateTime format. Returns True if the conversion succeeds.
AISODateis a date-and-time value in the ISO 8601 format.AReturnUTCis an optional Boolean parameter that indicates whether the resulting date-and-time value should take into account the Time offsets for the local time zone of the system that runs your application. The default isTrue.- If
AReturnUTCisTrue, the resulting value does not take into account the time offset for the local time zone. - If
AReturnUTCisFalse, the resulting value takes into account the time offset for the local time zone.
- If
Valueis the output variable for the resulting date-and-time value.
The following table demonstrates usage of AReturnUTC. The input AISODate date-and-time values are specified in the ISO 8601 format. This example calculates results for the local time zone (UTC+04:00).
AISODate
|
AReturnUTC
|
Text representation of TDateTime Result |
|---|---|---|
2013-10-18T18:36:22.966Z
|
True
|
10/18/2013 6:36:22 PM
|
2013-10-18T18:36:22.966Z
|
False
|
10/18/2013 10:36:22 PM
|
2013-10-18T18:36:22.966-03:00
|
True
|
10/18/2013 9:36:22 PM
|
2013-10-18T18:36:22.966-03:00
|
False
|
10/19/2013 1:36:22 AM
|
- Note:
-03:00is the time offset for theUTC-03:00time zone from UTC.