Skip to main content

DATEADD

Adds a specified number of days, months, years, hours, minutes, or seconds to a given date

Syntax

DATEADD(date, num, unit)

Arguments

  • date: The Unix timestamp (number) representing the starting date.
  • num: The number of units to add.
  • unit: The unit of time to add ("year", "month", "day", "hour", "minute", "second").

Example

DATEADD(1678886400, 7, "day") → Returns 1679491200 (March 24, 2023, 7 days after March 17, 2023).
DATEADD(1678886400, 1, "month") → Returns 1681305600 (April 17, 2023, 1 month after March 17, 2023).

Usage Notes:

  • The date argument must be a valid Unix timestamp.
  • The unit argument must be one of the following strings: "year", "month", "day", "hour", "minute", "second".
  • The function operates in UTC timezone.
  • The return value is a Unix timestamp representing the resulting date.