Unit 'DateUtils' Package
[Overview][Constants][Classes][Procedures and functions][Index] [#rtl]

TryISOStrToDateTime

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

Declaration

Source position: dateutil.inc line 473

function TryISOStrToDateTime(

  const aString: string;

  out outDateTime: TDateTime

):Boolean;

Arguments

aString

  

ISO 8601 date/time value examined in the function.

outDateTime

  

TDateTime type containing the date and time values from the function.

Function result

True if the time value is successfully converted to a TDateTime type.

Description

TryISOStrToDateTime is a Boolean function which attempts to convert an ISO 8601-formatted date/time value to a TDateTime type. aString contains the date/time value examined in the routine, and can use one of the supported ISO 8601 notations. Internally, TryISOStrToDateTime separates the value in aString into date and time parts and calls both TryISOStrToDate and TryISOStrToTime.

outDateTime is a TDateTime output parameter where the date/time value is stored in the function.

The return value is True if aString is successfully parsed and converted to a TDateTime type. The return value is False if aString contains a value that cannot be parsed in the function. When the return value is False, outDateTime is set to 0 (representing an empty date/time value).

Use TryISOStrToDate or TryISOStrToTime to convert a string using only a date or a time value (respectively).

Use TryISO8601ToDate to convert a string value which uses more intricate forms of the ISO 8601 time notation.

See also

TryISOStrToDate

  

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

TryISOStrToTime

  

Converts an ISO 8601-formatted time value to a TDateTime type.

TryISO8601ToDate

  

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


Documentation generated on: Oct 27 2024