2

如何更改 MySQL 中的 curtime 值,我运行查询SELECT CURTIME(),结果为18:49:12.

我想将值更改为17:49:12

如果有人知道这样做的好方法,我将非常感谢您的帮助。

4

4 回答 4

2

CURTIME() 值是基于服务器时区的值。您可以更改服务器时区:

SET time_zone = 'America/New_York';

或者使用 MySQL 函数 ADD_DATE() 执行此操作:

SELECT SELECT DATE_SUB(CURDATE(), INTERVAL 1 HOUR)
于 2012-08-27T10:56:28.700 回答
2

You could be set the time-zone manually, like so:

SET GLOBAL time_zone = '-1:00';

or to set to your system time:

SET GLOBAL time_zone = SYSTEM;

See the documentation for more information.

于 2012-08-27T10:56:55.440 回答
0

If you are trying to get a different time zone, you could apply timezone OR if u always want to get 1 hour before current time you could reduce the current time by 1 hour

于 2012-08-27T10:56:51.190 回答
0

哼,我觉得你做不到。这意味着mysql可以改变系统时间!

于 2012-08-27T10:53:53.617 回答