VeloDB Cloud
SQL Manual
Functions
date-time-functions
timestampadd

timestampadd

Description

Syntax:

DATETIME TIMESTAMPADD(unit, interval, DATETIME datetime_expr)

This function adds the integer expression interval to DATETIME or datetime_expr.

unit specifies the time unit of the interval. It should be one of the followings:

SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, or YEAR.

Example


mysql> SELECT TIMESTAMPADD(MINUTE,1,'2019-01-02');
+------------------------------------------------+
| timestampadd(MINUTE, 1, '2019-01-02 00:00:00') |
+------------------------------------------------+
| 2019-01-02 00:01:00                            |
+------------------------------------------------+

mysql> SELECT TIMESTAMPADD(WEEK,1,'2019-01-02');
+----------------------------------------------+
| timestampadd(WEEK, 1, '2019-01-02 00:00:00') |
+----------------------------------------------+
| 2019-01-09 00:00:00                          |
+----------------------------------------------+

Keywords

TIMESTAMPADD