Command Reference : String and Date Function Reference

Syntax: @dateadd(d, offset, u[, f])
Argument 1: date number, d
Argument 2: number of time units, offset
Argument 3: time unit, u
Argument 4: double, control flag, f
Return: date number
Returns the date number given by d offset by offset time units as specified by the time unit string u.
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, the optional 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).
Example:
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 “W” or “WW” as the time unit string:
returns 730123.0 (January 5, 2000).
Suppose that the value of d is 730091.0 (midnight, December 4, 1999), which is a Saturday: