Purpose
Returns the weekday (Monday, Tuesday, etc.) of a specified date.
Weekday functions can be coded in two ways, as shown in the syntax diagrams below.
Syntax
Format 1:
►►───┬─ WEEKDAY ──┬─ ( date, date-format ) ───────────────────────────────────►◄ └─ WEEKDAYX ─┘
Format 2:
►►───┬─ GWEEKDAY ──┬─ ( date ) ───────────────────────────────────────────────►◄ ├─ GWEEKDAYX ─┤ ├─ CWEEKDAY ──┤ ├─ CWEEKDAYX ─┤ ├─ EWEEKDAY ──┤ ├─ EWEEKDAYX ─┤ ├─ JWEEKDAY ──┤ └─ JWEEKDAYX ─┘
Parameters
Format 1:
Invokes the weekday function. WEEKDAYX operates on dates that contain the century portion of the year.
A numeric value that specifies the input date. Date can be:
Specifies the format of the date specified by date. Date-format can be:
Date-format can be:
Format 2:
The invocation names of the alternate formats of the weekday function. The prefix C, E, G, or J of an invocation name identifies the format of the date specified by date (calendar, European, Gregorian, or Julian.)
Invocation names ending in X operate on dates that contain the century portion of the year.
A numeric value that specifies the input date. Date can be:
Example 1 (Format 1)
In the following example, the weekday function is used to determine on which weekday January 28, 1958 fell. The date is provided in calendar format:
Statement:
MOVE WEEKDAY(012858,'C') TO WK-RESULT.
Returned value: 'TUESDAY'
Example 2 (Format 1)
This example returns the weekday for a date that contains the century portion of the year:
Statement:
MOVE WEEKDAYX(01281958,'C') TO WK-RESULT.
Returned value: 'TUESDAY'
Example 3 (Format 2)
This is equivalent to Example 2:
Statement:
MOVE CWEEKDAY(01281958) TO WK-RESULT.
Returned value: 'TUESDAY'
|
Copyright © 2014 CA.
All rights reserved.
|
|