DATEADD

Adds a number of days, months, or years to a date

Usage

DATEADD(date, number, [unit])

Parameters

date

(Required) The date to which to add days, months, or years

number

(Required) The number to add to the date. It can be positive or negative

unit

The unit of time to add (“days”, “months”, or “years”). Uses “days” if not specified

Examples

Example With these variables Result

DATEADD(start_date, 7, “days”)

start_date is DATE(2024, 1, 12)

DATE(2024, 1, 19)

DATEADD(start_date, delay)

start_date is DATE(2024, 1, 19)
delay is 14

DATE(2024, 2, 2)

DATEADD(DATE(2024, 1, 12), -1, “months”)

(None)

DATE(2023, 12, 12)

DATEADD(DATE(2023, 12, 31), 2, “months”)

(None)

DATE(2024, 2, 29)

DATEADD(DATE(2024, 1, 12), 2, “years”)

(None)

DATE(2026, 1, 12)

DATEADD(DATE(2024, 2, 29), 5, “years”)

(None)

DATE(2029, 2, 28)

More information

The unit parameter, if provided, must be one of ‘days’, ‘months’, or ‘years’.

If you add a negative number, you will subtract from the date.

Be cautious with adding months, as it considers the month boundaries. For instance, adding one month to January 31st will result in the last day of February.

Reminders

A text containing a date is not handled as a date. To have an actual date:

  • use the @DATE_QUESTION to set the variable
  • use a function that converts to a date: DATEVALUE(text_date)
  • use a function that returns a date: TODAY() or DATE(year, month, day)

A text containing digits is not handled as a number. To have an actual number:

  • use the @NUMBER_QUESTION to set the variable
  • write a numeric value directly in the code without quotes, ex: age >= 18
  • use a function which converts to a number: NUMBER(text_containing_numbers)
  • use a function which returns a number: FIND("world", "hello everybody")

See also