该NOW()功能提供服务器本地时区的当前时间.如果您希望转换为其他时区,可以使用CONVERT_TZ()
更新:
您可以使用每个连接时区(不影响系统时区)并获得所需的效果:
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2011-06-03 22:40:51 |
+---------------------+
1 row in set (0.00 sec)
mysql> SET time_zone = '+08:00';
Query OK, 0 rows affected (0.00 sec)
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2011-06-04 10:41:15 |
+---------------------+
1 row in set (0.00 sec)
Run Code Online (Sandbox Code Playgroud)