首頁 >資料庫 >mysql教程 >mysql 中 DATE

mysql 中 DATE

WBOY
WBOY原創
2016-06-07 15:08:38990瀏覽

mysql SELECT '1997-12-31 23:59:59' INTERVAL 1SECOND; - '1998-01-01 00:00:00' mysql SELECT INTERVAL 1 DAY '1997-12-31'; - '1998-01-01' mysql SELECT '1998-01-01' - INTERVAL 1SECOND; - '1997-12-31 23:59:59' mysql SELECT DATE_ADD('1997-12-3123


   mysql> SELECT '1997-12-31 23:59:59' + INTERVAL 1SECOND;

   -> '1998-01-01 00:00:00'

mysql> SELECT INTERVAL 1 DAY + '1997-12-31';

   -> '1998-01-01'

mysql> SELECT '1998-01-01' - INTERVAL 1SECOND;

   -> '1997-12-31 23:59:59'

mysql> SELECT DATE_ADD('1997-12-3123:59:59',INTERVAL 1 SECOND);

   -> '1998-01-01 00:00:00'

mysql> SELECT DATE_ADD('1997-12-3123:59:59',INTERVAL 1 DAY);

   -> '1998-01-01 23:59:59'

mysql> SELECT DATE_ADD('1997-12-3123:59:59',INTERVAL '1:1' MINUTE_SECOND);

   -> '1998-01-01 00:01:00'

mysql> SELECT DATE_SUB('1998-01-0100:00:00',INTERVAL '1 1:1:1' DAY_SECOND);

   -> '1997-12-30 22:58:59'

mysql> SELECT DATE_ADD('1998-01-0100:00:00',INTERVAL '-1 10' DAY_HOUR);

   -> '1997-12-30 14:00:00'

mysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31DAY);

   -> '1997-12-02'

mysql> SELECT DATE_ADD('1992-12-3123:59:59.000002',INTERVAL '1.999999' SECOND_MICROSECOND);

   -> '1993-01-01 00:00:01.000001'

 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn