
Description
The TEST-FORMATTED-DATETIME function tests the validity of a specified date, time or combined-datetime according to the format
specified. The type of this function is integer.
General Format
FUNCTION TEST-FORMATTED-DATETIME (argument-1, argument-2)
Arguments
- Argument-1 must a literal of type alphanumeric, UTF-8 or national, that contains a date, time or combined data time format.
See
Date and Time formats for details.
- Argument-2 must be of the same type as argument-1.
Returned Values
- The return value is the character offset to the first error in argument-2, or 0 if argument-2 is valid according to the format
in argument-1. Errors can be incorrect characters, incorrect length, invalid value ranges or invalid dates.
Example
Using the following arguments generates a return value of 5, as the fifth character of argument-2 ("4") contains an incorrect
value for the first digit of the month representation.
FUNCTION TEST-FORMATTED-DATETIME(âYYYYMMDD", "20124523")