SUBDATE(date,INTERVAL expr unit) 和 SUBDATE(expr,days)
当第二个参数INTERVAL形式调用, SUBDATE() 是DATE_SUB()的同义词,有关INTERVAL单位参数信息,请参阅DATE_ADD()的讨论。
mysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY); +---------------------------------------------------------+ | DATE_SUB('1998-01-02', INTERVAL 31 DAY) | +---------------------------------------------------------+ | 1997-12-02 | +---------------------------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT SUBDATE('1998-01-02', INTERVAL 31 DAY); +---------------------------------------------------------+ | SUBDATE('1998-01-02', INTERVAL 31 DAY) | +---------------------------------------------------------+ | 1997-12-02 | +---------------------------------------------------------+ 1 row in set (0.00 sec)