Sign in Join
FPDoc Onlineexperiment

ISO8601ToDate function

In unit DateUtils

Converts a date/time value in ISO 8601 notation to a native TDateTime type.

Declaration

pascal
function ISO8601ToDate(const DateString: string; 
 ReturnUTC: Boolean=True): TDateTime

Arguments

DateString

ISO 8601-formatted date/time value examined in the function.

ReturnUTC

Indicates if the return value should be adjusted to the UTC time zone.

Function result

TDateTime value for DateString.

Description

ISO8601ToDate is a function used to convert a string using ISO 8601 date/time notation to a native TDateTime type.

DateString contains the date/time value expressed using ISO 8601 notation.

ReturnUTC indicates if the TDateTime value should be adjusted to reflect the UTC (Coordinated Universal Time) time zone. The default value for the argument is True.

ISO8601ToDate calls the TryISO8601ToDate function to perform the conversion, and raises an EConvertError exception if DateString contains an invalid ISO 8601 date/time value. The return value contains the native TDateTime value for the timestamp (adjusted to UTC when requested).

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

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.