%WKDAY

Return the day of the week

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
day = %WKDAY([date])

or

xcall WKDAY(day[, date])

Return value

day

One of the following values that represents the weekday: (n)

1 = Sunday

2 = Monday

3 = Tuesday

4 = Wednesday

5 = Thursday

6 = Friday

7 = Saturday

Arguments

date

(optional) The date for which you want to determine the day of the week. This argument may be specified as either a numeric date or an alphabetic date. The default is the current date. (a or n)

Discussion

%WKDAY returns a numeric value that identifies the day of the week either for the current day or for the date passed.

If date is passed as a numeric value, the format must be YYYYMMDD. If the date is passed as an alpha value, the format can be

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

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).

See %JPERIOD for examples of valid dates.

If an invalid date is passed, an “Invalid date” error ($ERR_INVDATE) is generated.

Examples

.define TTCHN   ,1
record
    today       ,d1
    day         ,7a9,   "Sunday", "Monday", "Tuesday", "Wednesday", 
  &                     "Thursday", "Friday", "Saturday"
proc
    open(TTCHN, o, "tt:")
    xcall wkday(today)                                  ;Get day
    writes(TTCHN, "Today is" + day(today))              ;Display it
    close TTCHN
    xreturn
end