$ZDate()

$ZDATE Format Specification Elements
Examples of $ZDATE()

The $ZDATE function returns a date and/or time formatted as text based on an argument formatted in the manner of $HOROLOG. For information on the format of $HOROLOG, refer to the "Intrinsic Special Variables" chapter in this manual.

The format for the $ZDATE function is:

    $ZD[ATE](expr1[,expr2[,expr3[,expr4]]]])
    

$ZDATE() provides an easy and flexible tool for putting M internal date/time ($HOROLOG) formats into more user-friendly formats.

The Intrinsic Special Variable $ZDATEFORM determines the output format for years. The default value is zero (0), in which case $ZDATE() with one argument (no format specification) uses a "YY" (two digit) format for all years. If $ZDATEFORM is one (1), a "YYYY" (four digit) format is used for years later than 1999. For all other values of $ZDATEFORM, "YYYY" (four digit) format is used for all years. $ZDATEFORM does not affect $ZDATE() when the format argument is specified.

The following table summarizes the usage of $ZDATE() when only first argument is specified.

Value of $ZDATEFORM

$ZDATE() Output Format  

0

2 digits

1

4 digits for years 2000 and after

2 digits otherwise (for years ranging between 1840, 1999)

other

4 digits