SQL SUBDATE()函數

SUBDATE(date,INTERVAL expr unit) 和 SUBDATE(expr,days)

當第二個參數的INTERVAL形式調用,SUBDATE()是DATE_SUB()的同義詞。有關間隔單位參數信息,請參閱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)

0 條評論,你可以發表評論,我們會進行改進
Comment author placeholder