摘要:
下文讲述mysql数据库中日期函数ADDDATE方法简介说明,如下所示;
ADDDATE函数简介说明
ADDDATE函数是DATE_ADD函数的同义词,具有同样的功能,
其作用为:为指定的日期添加相应的时间
ADDDATE语法:
ADDDATE(date,INTERVAL expr unit)
--------参数说明--------
date:待操作的日期
expr:数字
unit:指定添加时间的单位
unit可能存在的参数值MICROSECOND
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
QUARTER
YEAR
SECOND_MICROSECOND
MINUTE_MICROSECOND
MINUTE_SECOND
HOUR_MICROSECOND
HOUR_SECOND
HOUR_MINUTE
DAY_MICROSECOND
DAY_SECOND
DAY_MINUTE
DAY_HOUR
YEAR_MONTH
ADDDATE函数示例说明
mysql> select adddate('2020-8-9',interval 1 day);
+------------------------------------+
| adddate('2020-8-9',interval 1 day) |
+------------------------------------+
| 2020-08-10 |
+------------------------------------+
1 row in set (0.00 sec)
mysql> select adddate('2020-8-9 10:00:00',interval 10 minute);
+-------------------------------------------------+
| adddate('2020-8-9 10:00:00',interval 10 minute) |
+-------------------------------------------------+
| 2020-08-09 10:10:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)