DATEADD()
Adds or subtracts datetime units from a datetime value
DATE
, TIME
or TIMESTAMP
DATEADD (<args>) <args> ::= <amount> <unit> TO <datetime> | <unit>, <amount>, <datetime> <amount> ::= an integer expression (negative to subtract) <unit> ::= YEAR | MONTH | WEEK | DAY | HOUR | MINUTE | SECOND | MILLISECOND <datetime> ::= a DATE, TIME or TIMESTAMP expression
Parameter | Description |
---|---|
amount |
An integer expression of the |
unit |
Date/time unit |
datetime |
An expression of the |
Adds the specified number of years, months, weeks, days, hours, minutes, seconds or milliseconds to a date/time value.
-
The result type is determined by the third argument.
-
With
TIMESTAMP
andDATE
arguments, all units can be used. -
With
TIME
arguments, onlyHOUR
,MINUTE
,SECOND
andMILLISECOND
can be used.