首页 > 数据库 > mysql教程 > mysql now() Incorrect datetime value for column_MySQL

mysql now() Incorrect datetime value for column_MySQL

WBOY
发布: 2016-06-01 13:45:21
原创
1235 人浏览过

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
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板