mysql now() Incorrect datetime value for column_MySQL

WBOY
發布: 2016-06-01 13:45:21
原創
1231 人瀏覽過

bitsCN.com

mysql> select now(); select now() -10;
+---------------------+
| now()               |
+---------------------+
| 2009-09-25 21:07:20 |
+---------------------+
1 row in set (0.00 sec)

+-----------------------+
| now() -10             |
+-----------------------+
| 20090925210710.000000 |
+-----------------------+
1 row in set (0.00 sec)

sometime it works, but sometime doesnt for
" mysql now() Incorrect datetime value for column "

There's an insidious problem doing simple maths using now() ... subtraction of seconds and minutes etc are based on 100 seconds in a minute, and 100 minutes in an hour ...

so, you need to be do something more like:
select now(); select now() -INTERVAL 10 SECOND;

and that's how to solver the problem.

bitsCN.com
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板