System.DateUtils.ISO8601ToDate

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ISO8601ToDate(const AISODate: string; AReturnUTC: Boolean = True): TDateTime;

C++

extern DELPHI_PACKAGE System::TDateTime __fastcall ISO8601ToDate(const System::UnicodeString AISODate, bool AReturnUTC = true);

Properties

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

Description

Converts the AISODate date-and-time value, specified in the ISO 8601 format, into the date-and-time value in the TDateTime format.

  • AISODate is a date-and-time value in the ISO 8601 format.
  • AReturnUTC is a boolean defining whether the returning date-and-time value should take into account the time offsets for the local time zone of the system running your application. The default is True.
    • If AReturnUTC is True, the resulting date-and-time value, in the TDateTime format, does not take into account the time offset for the local time zone.
    • If AReturnUTC is False, the resulting value takes into account the time offset for the local time zone.

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

Here -03:00 is the time offset for the (UTC-03:00) time zone from UTC.

See Also