MySQL Tutorial/Date Time Functions/ADDDATE — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:44, 26 мая 2010
ADDDATE(date,INTERVAL expr unit),
mysql>
mysql> SELECT DATE_ADD("1998-01-02", INTERVAL 31 DAY);
+-----------------------------------------+
| DATE_ADD("1998-01-02", INTERVAL 31 DAY) |
+-----------------------------------------+
| 1998-02-02 |
+-----------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql> SELECT ADDDATE("1998-01-02", INTERVAL 31 DAY);
+----------------------------------------+
| ADDDATE("1998-01-02", INTERVAL 31 DAY) |
+----------------------------------------+
| 1998-02-02 |
+----------------------------------------+
1 row in set (0.00 sec)
mysql>
ADDDATE(expr,days)
MySQL treats the second argument as an integer number of days to be added to expr.
mysql>
mysql> SELECT ADDDATE("1998-01-02", 31);
+---------------------------+
| ADDDATE("1998-01-02", 31) |
+---------------------------+
| 1998-02-02 |
+---------------------------+
1 row in set (0.00 sec)
mysql>