WEEKDAY_NR

Use the WEEKDAY_NR script function to return the day of the week of a particular date. The weekday is returned as a single-digit number.

Syntax

WEEKDAY_NR ([DateFormat:]Date)

Parameters

Parameter Description Format
Date Specifies the date.
Note: Specify the date format when you use a format other than YYMMDD or YYYYMMDD. Separate the date format and the date with a colon or semicolon. For more information, see Date, Time and Period Formats in Scripts.
script literal or script variable

Return Codes

The script function returns the following values:

Return Value Condition
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday
7 Sunday

Examples

December 31, 1999 was a Friday, so the following script returns the value 5:

: SET &NEWYEARSEVE_2000# = WEEKDAY_NR ('DD.MM.YY:31.12.99')

January 1, 2000 was a Saturday, so the following script returns the value 6:

: SET &NEWYEAR_2000# = WEEKDAY_NR ("DD.MM.YYYY:01.01.2000")

In both examples, the date format is specified because the dates provided are not in YYMMDD or YYYYMMDD format.

See also: