如何更改 MySQL 中的 curtime 值,我运行查询SELECT CURTIME()
,结果为18:49:12
.
我想将值更改为17:49:12
如果有人知道这样做的好方法,我将非常感谢您的帮助。
CURTIME() 值是基于服务器时区的值。您可以更改服务器时区:
SET time_zone = 'America/New_York';
或者使用 MySQL 函数 ADD_DATE() 执行此操作:
SELECT SELECT DATE_SUB(CURDATE(), INTERVAL 1 HOUR)
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.
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
哼,我觉得你做不到。这意味着mysql可以改变系统时间!