14. 1. 3. Changing Date Values |
|
DATE_ADD() and DATE_SUB() add and subtract time to a date. |
Syntax: |
DATE_ADD(date,INTERVAL expr type)
DATE_SUB(date,INTERVAL expr type)
|
|
The date - is a standard DATE or DATETIME value. |
INTERVAL is followed by the time period (expr). |
Finally what type period it is (Month, Day, Year etc). |
mysql>
mysql> SELECT DATE_ADD(CURDATE(), INTERVAL 60 DAY);
+--------------------------------------+
| DATE_ADD(CURDATE(), INTERVAL 60 DAY) |
+--------------------------------------+
| 2007-09-19 |
+--------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql>
|
|