This function provides a way of doing date arithmetic in terms of
weeks rather than days.
Function name is "w" for "week arithmetic".
EXAMPLE: Fdate /Fw /Nnumdays /Adate /Iformat /Oformat
This function accepts a date specification in parm /A and
returns the date of the /Nth /Day-of-the-week
before or after /Adate. For example, if...
- /A specifies November 14, 1992
- /D specifies the number for Thursday (i.e., 5)
- /N specifies a week count of 3
then /Fw returns the date of the third Thursday after
November 14, 1992. (See full example, below)
NEGATIVE VALUES FOR /N
Note that /N may be negative. If, in the above example, /N
is specified as -3, then Fdate returns the date of the third
Thursday BEFORE November 14, 1992.
The acceptable values for /N (number of weeks) is in
the range of 99..-99. A value of zero (i.e. /N0) is invalid.
A BIT OF TRICKINESS WITH WEEKDAY ARITHMETIC
There is a small dilemma inherent in the notion of weekday arithmetic.
If the date specified on the /A parm falls on the same day of the week
(say, Thursday) as the day of the week that was specified on the /D
parm, should (or should not) the /A date be considered the first date
that meets the day-of-week criterion? For example, if day X is a
Thursday, and we specify that we want the first Thursday ("/N1 /D5")
from day X, should we get day X itself, or the Thursday that is 7 days
after day X?
Depending on what you're trying to do, one or the other kind of
behavior will be preferable. Starting with version 9.2, Fdate
supports both kind of processing. When using the weekday arithmetic
function (/Fw), you can determine the kind of processing that takes
place by specifying (or omitting) the /X (exclude) parm. That is, if
the date specified on the /A parm falls on the day of the week
specified on the /D parm, then...
IF THE /X PARM IS NOT PRESENT ...
- then the /A date will be considered to be the first date meeting the
day-of-week criterion. For example, suppose that /D specified
Thursday and /A specified Thursday, November 14, 1992. If /N was 1 or
-1, then the output date would be the same as the input date, i.e.
Thursday November 14, 1992.
IF THE /X PARM IS PRESENT ...
- then the /A date will be EXCLUDED from consideration when looking for
the first day to meet the day-of-week criterion. For example, suppose
that /D specified Thursday and /A specified Thursday November 14,
1992. If /N was 1, then the output date would be the following
Thursday, November 21, 1992. If /N was -1, then the output date would
be the preceding Thursday, November 7, 1992.
find date of Thanksgiving (4th Thursday in November) in 1992
Fdate /Fw /A11-01-1992 /Imm-dd-ccyy /D5 /N4 /Od1
returns: Thursday November 26, 1992
find the beginning of the work-week (Monday, 2nd day of week)
AFTER Thanksgiving, 1992
Fdate /Fw /A11-26-1992 /Imm-dd-ccyy /D2 /N1 /Od1
find the beginning of the work-week (Monday, 2nd day of week)
BEFORE Thanksgiving, 1992
Fdate /Fw /A11-26-1992 /Imm-dd-ccyy /D2 /N-1 /Od1
find last Friday's date (even if today is Friday)
Fdate /Fw /At /D6 /N-1 /X /P"Last Friday was: "