C:\Users\zany>mysql -u root -p Enter password: ******* Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.1.32-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select now() as today; +---------------------+ | today | +---------------------+ | 2009-04-30 11:49:00 | +---------------------+ 1 row in set (0.00 sec)
mysql> select date_add(now(), interval -1 day) as yesterday; +---------------------+ | yesterday | +---------------------+ | 2009-04-29 11:49:00 | +---------------------+ 1 row in set (0.00 sec)
mysql> select date_add(now(), interval 1 day) as tomorrow; +---------------------+ | tomorrow | +---------------------+ | 2009-05-01 11:49:00 | +---------------------+ 1 row in set (0.00 sec)
mysql> select date_add(now(), interval 1 month) as `1 month ago`; +---------------------+ | 1 month ago | +---------------------+ | 2009-05-30 11:49:00 | +---------------------+ 1 row in set (0.00 sec)
mysql> select date_add(now(), interval 1 year) as`1 year ago`; +---------------------+ | 1 year ago | +---------------------+ | 2010-04-30 11:49:00 | +---------------------+ 1 row in set (0.00 sec)
mysql>
³¯Â¥ ¿¬»êÀº ÀÌ·¸°Ô ÇÏ¸é µÇ°Ú´Ù. date_sub µµ Àִµ¥, date_add ¶û ¿ÏÀü µ¿ÀÏÇÏ°í ³¯Â¥¸¦ »©´Âµ¥¸¸ »ç¿ëµÈ´Ù. °Á date_add ·Î ÅëÀÏÇÏ°í ¾ç¼ö,À½¼ö°ªÀ» ÁÖ´Â °É·Î ÇØ°áÇÏ¸é µÇ°Ú´Ù.
EOF : Zany (2009-04-30)
|
|
|