%DATE

Return the date

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
date = %DATE([jperiod])

or

xcall DATE(date[, jperiod])

Return value

date

A formatted date string, stored left-justified over blanks. (a)

Arguments

jperiod

(optional) The Julian period for the date to be returned. The default is the current date. (n)

Discussion

Depending on whether the destination is a9 or a11, the DATE subroutine returns either the current date or the date for the Julian period passed in the format DD-MMM-YY or DD-MMM-CCYY, where DD is the day of the month, MMM is the abbreviation for the month, YY is the last two digits of the year (for example, 11-NOV-91), and CCYY is the year with the century included.

The %DATE function, on the other hand, always returns the date in the format DD-MMM-CCYY. If the length of date is not large enough to receive the entire result, the date is truncated, with the truncated value stored according to the alpha to alpha storage rules. (See Moving alpha data to an alpha destination for more information.) For example, if date is an a9 field, the returned date is truncated to DD-MMM-CC.

The abbreviations for the months are as follows:

JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
DEC

Examples

The following example checks to see if the current date is the same as the date passed to the function. If it is the same, the function returns a value of true; otherwise, it returns a value of false.

function chk_exp_date                   ;Called daily to generate expired account list
    a_expdate           ,a              
proc
    freturn (%date .eq. a_expdate)      ;Return TRUE if expired today, else FALSE
endfunction