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

# TryISOStrToDate

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

## Declaration

Source position: dateutil.inc line 458

`function TryISOStrToDate(`
`const aString: string;`
`out outDate: TDateTime`
`):Boolean;`

## Arguments

`aString` |  | ISO 8601 date value converted in the function
`outDate` |  | Contains the TDateTime value for the string; time portion is not used

## Function result

True if the date value is successfully converted

## Description

TryISOStrToDate is a Boolean function which attempts to convert an ISO 8601-formatted date value in aString to a TDateTime type. The return value is True if the string is successfully converted into a native date value.

aString contains the date value converted in the function, and can use one of the following ISO 8601 notations :

- YYYYMMDD
- YYYY-MM-DD

outDate is an output parameter where the converted TDateTime value is stored in the function. The return value is False (and outDate is set to an empty date value) if aString cannot be converted in the routine.The time portion of the TDateTime value is not used or updated in the function.

Use TryISOStrToTime to convert a time value to a native TDateTime type.

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

## See also

TryISOStrToTime |  | Converts an ISO 8601-formatted time value to a TDateTime type
TryISOStrToDateTime |  | Attempts to convert an ISO 8601-formatted date/time value to a TDateTime type

Documentation generated on: May 14 2021