Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 987 Bytes

File metadata and controls

38 lines (26 loc) · 987 Bytes

timestampadd

description

Syntax

DATETIME TIMESTAMPADD(unit, interval, DATETIME datetime_expr)

将整数表达式间隔添加到日期或日期时间表达式datetime_expr中。

interval的单位由unit参数给出,它应该是下列值之一:

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                          |
+----------------------------------------------+

keyword

TIMESTAMPADD