`
chembo
  • 浏览: 940935 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

【解决】mysql now() Incorrect datetime value for column

阅读更多
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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics