date_add

Moves a timestamp by a number of units: "second", "minute", "hour", "day", "week", "month" or "year" (a negative number moves back). Days, months and years are calendar units in the app's timezone, so adding a day across a daylight-saving change keeps the time of day; a month from January 31 lands in early March, as the calendar overflows.

Runs on: either side: the compiler places the statement that calls it where the values it uses live.

Format:

date_add(timestamp, amount, unit)

Parameters:

Parameter Type Description
timestamp number the UNIX timestamp
amount number how many units; negative to go back
unit string "second", "minute", "hour", "day", "week", "month" or "year"

Returned Value:

Type Description
number the moved timestamp

Examples

reminder_at = date_add(event.starts_at, -1, "day")