Command Reference : String and Date Function Reference

Date number after applying offset.
d: date number
offset: integer
u: time unit string
f: (optional) number
Return: date number
Returns the date number given by d offset by offset time units as specified by the time unit string u. The optional parameter f controls handling of business days.
The valid time unit string values are: “A” or “Y” (annual), “S” (semi-annual), “Q” (quarters), “MM” (months), “WW” (weeks), “DD” (days), “B” (business days), “HH” (hours), “MI” (minutes), “SS” (seconds).
When the time unit u is business days (“B”), the optional control flag parameter f controls how a non-business day date number d is handled. When f is absent or equal to zero, the date number d is automatically advanced to the next business day before offset is applied. Otherwise, when f is non-zero automatic advancement is suppressed. Consequently, when f is non-zero and offset is 0 the function returns the original date number d (a non-business day).
Examples
Suppose that the value of d is 730088.0 (midnight, December 1, 1999).
Then we can add and subtract 10 days from the date by using the functions
which return 730098.0 (December 11, 1999) and (730078.0) (November 21, 1999). Note that these results could have been obtained by taking the original numeric value plus or minus 10.
To add 5 weeks to the existing date, simply specify “WW” as the time unit string:
returns 730123.0 (January 5, 2000).
To find the date 3 months prior to the existing date, specify “MM” as the time unit string:
The function may usefully be combined with other date functions. To find the day of the week 4 months from DD:
Business day adjustments are slightly more complex. Suppose that the value of DD is 730091.0 (midnight, December 4, 1999), which is a Saturday:
730091.0
Then the previous business day, may be obtained by
which both return 730090.0 (December 3, 1999), the preceding Friday.
A business day offset of 0 with a zero (or omitted) control flag f, automatically advances to the next business day
returns 730093.0 (December 6, 1999), the following Monday.
A business day offset of 0 with a non-zero control flag f, does not advance from the original day, so that
returns 730091.0 (December 4, 1999), the original Saturday.
Automatic business day adjustments are performed prior to applying the offset parameter, so that