ADDDAYS
The ADDDAYS function adds a specified number of days to a given date.
You cannot use ADDDAYS on a date/time object that does not specify the day of the month because an error will occur.
- Syntax:
- ADDDAYS (single-date-expression, single-integer-expression)
- Meaning:
- ADDDAYS (any_date, number_of_days_to_add)
- Returns:
- A single date
The ADDDAYS function returns the date, which results from adding number_of_days_to_add to any_date. If any_date has a presentation that does not contain a century, the century is determined based on the Century > CCLookup map setting (when the Century > Switch = ON), or the current century (when the Century > Switch = OFF).
When the year exceeds four digits, the output will display hash characters (#) for the CCYY values because the field is defined to be only four digits in length.
Examples
- You can use the ADDDAYS function to
increment a date by a fixed number of days, such as to calculate a DueDate that
is always 30 days after the InvoiceDate.
To produce a date in the output, such as a ship date, you might need to add a variable number of days to a date in the input. For example: ADDDAYS (PODate, LeadTime).
- ADDDAYS (InvoiceDate, 10)
Returns the date, which results from adding 10 days to the value of InvoiceDate.
- ADDDAYS (InvoiceDate, DaysTilDue)
Returns the date that results from adding the value of DaysTilDue to the InvoiceDate value.
- ADDDAYS (TODATETIME ("000101"),
-1)
Returns 991231
- ADDDAYS (TODATETIME ("20000101"),
1)
Returns 20000102
- ADDDAYS (TODATETIME ("10/20/1996",
"{MM/DD/CCYY}"), 5)
Returns 10/25/1996
In the examples containing TODATETIME, the text literal is first converted to a date, and then the specified number of days is added to that date.
Related functions
- ADDHOURS
- DATETONUMBER
- NUMBERTODATE
- TEXTTODATE
- TODATETIME