当前时间:
mysql> select now();
+---------------------+| now() |+---------------------+| 2014-07-03 21:16:22 |+---------------------+1 row in set (0.00 sec)下一个月:> select date_add(now(),interval 1 month);+----------------------------------+| date_add(now(),interval 1 month) |+----------------------------------+| 2014-08-03 21:16:28 |+----------------------------------+1 row in set (0.00 sec)上一个月:mysql> select date_add(now(),interval -1 month);+-----------------------------------+| date_add(now(),interval -1 month) |+-----------------------------------+| 2014-06-03 21:17:02 |+-----------------------------------+1 row in set (0.00 sec)三个月前:
DATE_SUB(NOW(), INTERVAL 3 MONTH)
三个天前:
SELECT DATE_SUB(NOW(), INTERVAL 3 DAY)