NOW(): Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHFunctions and Operators HHMMSS format, depending on whether the function is used in a string or numeric context. mysql> SELECT NOW(); -> '1997-12-15 23:50:26' mysql> SELECT NOW() + 0; -> 19971215235026 这是Manual里的解释。返回的就是数据库所运行的服务器的系统时间。
那么 Now() 就能够返回 2005-03-20 16:12:15
如果是Linux机子远程调试,那么linux的系统时间也许有问题
Now()获取的是系统的时间。
+---------------------+
| now() |
+---------------------+
| 2005-03-21 17:24:33 |
+---------------------+
1 row in set (0.03 sec)
登陆mysql,直接查询Now()
如果打印的时间不正确,那就肯定是数据库服务器的时间设置有问题~~!
Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHFunctions
and Operators HHMMSS format, depending on whether the function is used in a string or numeric context.
mysql> SELECT NOW();
-> '1997-12-15 23:50:26'
mysql> SELECT NOW() + 0;
-> 19971215235026
这是Manual里的解释。返回的就是数据库所运行的服务器的系统时间。