TEST-DATE-TIME
The TEST-DATE-TIME function takes a date, time, or timestamp item; alphanumeric item; numeric packed or zoned item; and determines if it is a valid date, time or timestamp. It returns true (B'1') if it is a valid item or false (B'0') if it is not a valid item.
The function type is boolean.
Format >>-FUNCTION TEST-DATE-TIME--------------------------------------> >--(--argument-1--+--------------------------------------------+--)->< '-argument-2--+----------------------------+-' '-argument-3--+------------+-' '-argument-4-'
- argument-1
- Can be:
- A date, time, or timestamp item
- An item of class alphanumeric
- A non-numeric literal
- An item of class numeric integer.
If argument-1 is a date, time, or timestamp item, then argument-2 through argument-4 are optional. If argument-1 is not a date, time, or timestamp item, argument-2 must be specified (argument-3 and argument-4 are optional).
Argument-1 is tested to see if it is a valid item, based on its type or on argument-2 through argument-4.
- argument-2
- Must be one of the following keywords:
- DATE
- TIME
- TIMESTAMP.
If argument-2 is TIMESTAMP, argument-3 can only be specified with FORMAT OF special register,
and argument-4 cannot be specified.
- argument-3
- Specifies the format of a date or time item. It must be:
- A nonnumeric literal at least 2 characters long
- The keyword LOCALE
- The FORMAT OF special register.
If argument-3 is the keyword LOCALE, then the format of the date or time is based on a LOCALE. If argument-4 is not specified, the current locale is used, otherwise the locale associated with the mnemonic-name or the LOCALE OF special register is used.
If argument-3 is not specified, the format used for
the test is the one defined in the SPECIAL-NAMES FORMAT clause.
For TIMESTAMP, if argument-3 is not specified, the default format of @Y-%m-%d-%H%M%S.@Sm is used.
- argument-4
- Must be a mnemonic-name associated with a LOCALE, or the LOCALE OF special
register.
Argument-4 must follow these rules:
- If argument-4 is specified and argument-3 is a locale-based format literal, for example contains %p, then the locale-based format literal would use the locale specified in argument-4 to determine the actual value of the conversion specifiers.
- If argument-3 is a locale-based format literal (for example, contains %p) and argument-4 is not specified, the locale-based format literal would use the current locale to determine the actual value of the conversion specifiers.
- If argument-3 is a locale-based format literal (for example, contains %p), and the LOCALE OF special register is used to refer to a non-locale item, the locale-based format literal would use the default locale to determine the actual value of the conversion specifiers.
