TIMESTAMPADD
Add (or subtract) an interval of time from a date/timestamp value or column.
Syntax
TIMESTAMPADD(unit symbol, count integer, givenTime date or timestamp) → date or timestamp
unit: The unit of the interval. Must be one of the following:
YEAR
,QUARTER
,MONTH
,WEEK
,DAY
,HOUR
,MINUTE
,SECOND
.count: Number of units to be added (or subtracted) from
givenTime
. To subtract units, pass a negative number.givenTime: Value to which to add units (either a database column in
DATE
orTIMESTAMP
format, or literal value explicitly converted toDATE
orTIMESTAMP
).
Examples
TIMESTAMPADD example
TIMESTAMPADD example
Get TIMESTAMP as of 30 mins ago
Get TIMESTAMP in 3 seconds
Last updated