1. Docs
  2. Formulas
  3. Functions

DATE_ADD

Adds an amount of time to a date and returns the result in UTC as ISO 8601 text. Use a negative amount to subtract.

The unit is one of seconds, minutes, hours, days, weeks, months, or years. Days, weeks, months, and years need a whole number. Adding months or years keeps the day of the month where it exists, and otherwise uses the last day of the month.

The date can be text, a Unix timestamp, or a DATE_PARSE object, and is read the same way DATE reads it. Unlike DATE, a date that can't be read is an error. To format the result, pass it to DATE.

Categories: Dates/Times

Syntax

DATE_ADD(date, amount, unit)

Examples

Example 1

Formula

DATE_ADD("2024-01-15", 3, "days")

Output

"2024-01-18T00:00:00.000+00:00"

Example 2: Use a negative amount to subtract.

Input

1
{
2
"my_action": {
3
"created_at": "2024-03-01T10:00:00Z"
4
}
5
}

Formula

DATE_ADD(my_action.created_at, -2, "hours")

Output

"2024-03-01T08:00:00.000+00:00"

Example 3: Adding months or years keeps the day of the month where it exists, and otherwise uses the last day of the month.

Formula

DATE_ADD("2024-01-31", 1, "months")

Output

"2024-02-29T00:00:00.000+00:00"

Example 4: Pass the result to DATE to format it.

Formula

DATE(DATE_ADD("2024-01-15", 30, "days"), "%Y-%m-%d")

Output

"2024-02-14"

Example 5: To add to the current time, pass NOW().

Formula

DATE_ADD(NOW(), 7, "days")

Output

"2024-05-21T09:21:09.483+00:00"

Example 6: Takes Unix timestamps.

Formula

DATE_ADD(1647712411, 1, "weeks")

Output

"2022-03-26T17:53:31.000+00:00"

Example 7: Takes DATE_PARSE objects, which is how to add to a date in an unusual format.

Formula

DATE_ADD(DATE_PARSE("05/04/1994", "%d/%m/%Y"), 1, "years")

Output

"1995-04-05T00:00:00.000+00:00"
Was this helpful?