TryISOStrToDate function
Attempts to convert an ISO 8601-formatted date value to a TDateTime type.
Declaration
function TryISOStrToDate(const aString: string; out outDate: TDateTime)
: BooleanArguments
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 :
- YYYY (assumes month is 1 and day of month is 1)
- YYYYMM (assumes day of month is 1)
- YYYY-MM (assumes day of month is 1)
- 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
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
