dateadd
function
Applies to: Databricks SQL
Databricks Runtime 10.4 and above
Adds value
unit
s to a timestamp expr
.
Syntax
dateadd(unit, value, expr)
unit
{ MICROSECOND |
MILLISECOND |
SECOND |
MINUTE |
HOUR |
DAY | DAYOFYEAR |
WEEK |
MONTH |
QUARTER |
YEAR }
Arguments
unit
: A unit of measure.value
: A numeric expression with the number ofunit
s to add toexpr
.expr
: A TIMESTAMP expression.
Returns
A TIMESTAMP.
If value
is negative it is subtracted from the expr
.
If unit
is MONTH
, QUARTER
, or YEAR
the day portion of the result will be adjusted to result in a valid date.
The function returns an overflow error if the result is beyond the supported range of timestamps.
dateadd
is a synonym for timestampadd.