$DateChk
The $DATECHK function determines whether a given date is valid. $DATECHK returns a 1 if the date is valid. A 0 is returned if either the date is invalid or if the date does not match a format you specify.
Syntax
The format of the $DATECHK function is:
$DATECHK(format, date)
where:
- format specifies the format of the date, which can be a combination of the following elements:
DD | Gregorian numeric day |
DDD | Julian numeric date |
MM | Numeric month |
MON | Abbreviated month name |
MONTH | Full month name |
YY | Last two digits of numeric year (assumes that the year prefix is 19) |
YYYY | Full numeric year |
CYY | The century, plus the year. Century (C) is a single digit, where 0 represents 1900, 1 represents 2000, and so on. |
Valid formats are:
A format that has a month, day, and year element
A Julian date format that has a year element and a day element in the format DDD
Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length.
- date specifies a date in the format indicated by the format argument. The date can be as many as 36 characters in length.
Example
PRINT $DATECHK('MON. DD, YYYY','FEB. 30, 1999')
prints the value 0 because the month of February does not have 30 days.