3.2.21. DATE([option_out [,date [,option_in]]])

This function returns information relating to the current date. If
the option_out character is specified, it will set the format of
the return string. The default value for option_out is “N”.

Possible options are:

[B]
     (Base) The number of complete days from January 1st 0001
     until yesterday inclusive, as a whole number. This function
     uses the Gregorian calendar extended backwards. Therefore
     Date(‘B’) // 7 will equal the day of the week where 0
     corresponds to Monday and 6 Sunday.

[C]
     (Century) The number of days in this century from January 1st
     —00 until today, inclusive. The return value will be a
     positive integer.

[D]
     (Days) The number of days in this year from January 1st until
     today, inclusive. The return value will be a positive
     integer.

[E]
     (European) The date in European format, i.e. ”dd/mm/yy”. If
     any of the numbers is single digit, it will have a leading
     zero.

[M]
     (Month) The unabbreviated name of the current month, in
     English.

[N]
     (Normal) Return the date with the name of the month
     abbreviated to three letters, with only the first letter in
     upper case. The format will be “dd Mmm yyyy”, where Mmm is
     the month abbreviation (in English) and dd is the day of the
     month, without leading zeros.

[O]
     (Ordered) Returns the date in the ordered format, which is
     “yy/mm/dd”.

[S]
     (Standard) Returns the date according the format specified by
     International Standards Organization Recommendation ISO/R
     2014-1971 (E). The format will be “yyyymmdd”, and each part
     is padded with leading zero where appropriate.

[U]
     (USA) Returns the date in the format that is normally used in
     USA, i.e. “mm/dd/yy”, and each part is padded with leading
     zero where appropriate.

[W]
     (Weekday) Returns the English unabbreviated name of the
     current weekday for today. The first letter of the result is
     in upper case, the rest is in lower case.

Note that the “C” option is present in REXX language level 3.50,
but was removed in level 4.00. The new “B” option should be used
instead. When porting code that use the “C” option to an
interpreter that only have the “B” option, you will can use the
conversion that January 1st 1900 is day 693595 in the Gregorian
calendar.

Note that none of the formats in which DATE() return its answer
are effected by the settings of NUMERIC. Also note that if there
are more than one call to DATE() (and TIME()) in a single clause
of REXX code, all of them will use the same basis data for
calculating the date (and time).

If the REXX interpreter contains national support, some of these
options may return different output for the names of months and
weekdays.

Assuming that today is January 6th 1992:

     DATE(‘B’) –>   ‘727203’
     DATE(‘C’) –>   ‘33609’
     DATE(‘D’) –>   ‘6’
     DATE(‘E’) –>   ‘06/01/92’
     DATE(‘M’) –>   ‘January’
     DATE(‘N’) –>   ‘6 Jan 1992’
     DATE(‘O’) –>   ‘92/01/06’
     DATE(‘S’) –>   ‘19920106’
     DATE(‘U’) –>   ‘01/06/92’
     DATE(‘W’) –>   ‘Monday’

If the date option is specified, the function provides for date
conversions.  The optional option_in specifies the format in which
date is supplied.  The possible values for option_in are:
BDEOUNS.
The default value for option_in is N.

     DATE(‘O’, ‘13 Feb 1923’) –>   ‘23/02/13’
     DATE(‘O’, ‘06/01/50’, ‘U’)    ->   ‘50/06/01’

 If the date supplied does not include a century in its format,
then the result is chosen to make the
 year within 50 years past or 49 years future of the current year.

The date conversion capability of the DATE BIF was introduced with
the ANSI standard.



PREV NEXT