[Overview][Constants][Procedures and functions][Index] Reference for unit 'DateUtils' (#rtl)

TryISO8601ToDate

Attempts to convert an ISO 8601-formatted date/time value to a TDateTime type

Declaration

Source position: dateutil.inc line 472

function TryISO8601ToDate(

  const DateString: string;

  out ADateTime: TDateTime;

  ReturnUTC: Boolean = True

):Boolean;

Arguments

DateString

  

ISO 8601-formatted date/time value converted in the function

ADateTime

  

Stores the native date/time value from the conversion

ReturnUTC

  

Indicates if the native date/time value is adjusted to the UTC time zone

Function result

True if the conversion was successful

Description

TryISO8601ToDate is a Boolean function which attempts to convert an ISO 8601-formatted date/time value to a TDateTime type.

DateString contains the ISO 8601 date/time value converted in the function. DateString must contain one of the supported ISO 8601 date/time notations supported in the routine. It is separated into date, time, and time zone values, and is converted by calling both the TryISOStrToDateTime and TryISOTZStrToTZOffset functions. See TryISOStrToDateTime for more information about supported ISO 8601 notations.

ReturnUTC indicates if the native date/time value needs to be adjusted to the UTC (Coordinated Universal Time) time zone. The default value for the argument is True, and causes GetLocalTimeOffset to be called to get and apply the time zone offset for the local computer.

ADateTime contains the native TDateTime value for the converted timestamp adjusted to the UTC time zone when ReturnUTC contains True.

Use DateToISO8601 to convert a native date/time value back to its representation in ISO 8601 notation.

See also

DateToISO8601

  

Converts a TDateTime value to ISO 8601 date/time format


Documentation generated on: May 14 2021