From m204wiki
Revision as of 19:24, 23 September 2015 by JAL (talk | contribs) (more conversion cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.


The format of the $DateChk function is:

$DateChk(format, date)


  • 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.


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')