Skip to content

TryISOStrToTime

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

Declaration

Source position: dateutil.inc line 447

  function TryISOStrToTime(const aString: string; out outTime: TDateTime)
                           : Boolean;

Description

TryISOStrToTime is a Boolean function which attempts to convert the specified ISO 8601 time value to a TDateTime type. aString contains the ISO 8601 time value examined in the function, and can use one of the following notations:

HHNN HHNNSS HHNNSS.ZZZ HH:NN HH:NN:SS HH:NN:SS.ZZZ

aString may contain an optional time zone designation at the end of the string value, like 'Z' for Zulu time zone or a time zone offset expressed using either positive or negative hours and minutes. For example:

16:00:00Z 12:00:00-04:00

The return value is True if the time value in aString is successfully converted in the function.

outTime is a TDateTime type used to store the time value converted in the function. When the return value is False, outTime contains 0 for an empty time value.

Use TryISOStrToDate to convert an ISO 8601 date value to a TDateTime type.

Use TryISOStrToDateTime to convert a string which contains both date and time values to a TDateTime type.

See also

Name Description
TryISOStrToDate Attempts to convert an ISO 8601-formatted date value to a TDateTime type
TryISOStrToDateTime Attempts to convert an ISO 8601-formatted date/time value to a TDateTime type