DATEADD

functionsupportedCore SQL functions

docs.snowflake.com ↗

Date & time functions

Adds the specified value for the specified date or time part to a date, time, or timestamp.

Syntax

DATEADD( <date_or_time_part>, <value>, <date_or_time_expr> )

Parameters

NameRequiredDescription
date_or_time_partrequiredThis indicates the units of time that you want to add. For example if you want to add two days, then specify day. This unit of measure must be one of the values listed in Supported date and time parts.
valuerequiredThis is the number of units of time that you want to add. For example, if the units of time is day, and you want to add two days, specify 2. If you want to subtract two days, specify -2.
date_or_time_exprrequireddate_or_time_expr must evaluate to a date, time, or timestamp. This is the date, time, or timestamp to which you want to add. For example, if you want to add two days to August 1, 2024, then specify '2024-08-01'::DATE. If the data type is TIME, then the date_or_time_part must be in units of hours or smaller, not days or bigger. If the input data type is DATE, and the date_or_time_part is hours or smaller, the input value will not be rejected, but instead will be treated as a TIMESTAMP with hours, minutes, seconds, and fractions of a second all initially set to 0 (e.g. midnight on the specified date).

Returns

If date_or_time_expr is a time, then the return data type is a time. If date_or_time_expr is a timestamp, then the return data type is a timestamp. If date_or_time_expr is a date: - If date_or_time_part is day or larger (for example, month, year), the function returns a DATE value. - If date_or_time_part is smaller than a day (for example, hour, minute, second), the function returns a TIMESTAMP_NTZ value, with 00:00:00.000 as the starting time for the date.

Usage notes

See also