%NDATE

Return a numeric date

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

or

xcall NDATE(date[, source])

Return value

date

A date value in the format YYYYMMDD. (n)

Arguments

source

(optional) The source from which %NDATE calculates the returned date. (a or n)

Discussion

%NDATE returns a numeric date either for the current operating system date or for the Julian period or date string passed.

If source is numeric, it is assumed to be the Julian period for the date to be returned. If source is alphanumeric, it is interpreted as a standard alpha date in the following format:

[DD][-][MMM][-][YYYY]

or

+|-n

The hyphen delimiters in the first format are optional, but they must be specified if leading components are omitted. Any omitted component defaults to the current value.

The second format indicates plus or minus n days from the current date (for example, +5 or -10).

The default is the current date. See %JPERIOD for more information.

Examples

record
    group date          ,d8
      year              ,d4
      month             ,d2
      day               ,d2
    endgroup
    adate               ,a10
proc
    open(1, o, "TT:")
    xcall ndate(date)
    adate = ^a(day) + "/" + ^a(month) + "/" + ^a(year)
    writes(1, "Today is " + adate)
    date = %ndate("+7")
    adate = ^a(day) + "/" + ^a(month) + "/" + ^a(year)
    writes(1, "Next week is " + adate)
    close 1
    stop
end