Printer Version |
Table of Contents |
Project Home Page |

.CATEGORY....: functions

.DISCUSSION..:

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

__NEGATIVE VALUES FOR /N__

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__

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.

- 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: "