Changing Date Values : Introduction : Date Time Functions MySQL TUTORIALS


MySQL TUTORIALS » Date Time Functions » Introduction »

 

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                           |
+--------------------------------------+
row in set (0.00 sec)

mysql>
mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Date Time Functions
» Introduction