$DateChk
Jump to navigation
Jump to search
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:
- 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.
- date specifies a date in the format indicated by the format argument. The date can be as many as 36 characters in length.
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:
Any EBCDIC characters except single quotes are allowed within the format. The format can be as many as 32 characters in length.
Example
The following statement prints the value 0, because the month of February does not have 30 days.
PRINT $datechk('MON. DD, YYYY','FEB. 30, 1999')