Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

记录时间总是比服务器时间提前8小时 #73

Open
ghost opened this issue Jan 30, 2023 · 3 comments
Open

记录时间总是比服务器时间提前8小时 #73

ghost opened this issue Jan 30, 2023 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 30, 2023

服务器设置为UTC+8时,日志记录的时间则总在北京时间的基础上又加8个小时。
此项设置在插件代码何处可以修改?

@xwyam
Copy link

xwyam commented Feb 28, 2023

同样的问题
基础环境是docker镜像webdevops/php-nginx:8.0,没有修改任何nginx和php时区相关的配置。
查了数据库,发现数据库里的时间是正常的。怀疑可能只是前台显示的问题。

@jinchub
Copy link

jinchub commented Jun 8, 2023

我的也是,把数据库存的时间戳拿出来看,也是快8小时。
把php.ini,配置下date.timezone = Asia/Shanghai,重启下php
然后禁用再启动下插件,就显示正常了

@maomao996
Copy link

Access_Core.php文件第166行改成$time = (new DateTime("now", new DateTimeZone("Asia/Shanghai")))->getTimestamp();
其中Asia/Shanghai换成想要的时区。
数据库中时间戳也错误的话执行下面这个:
UPDATE typecho_access_logs SET time = UNIX_TIMESTAMP(FROM_UNIXTIME(time) - INTERVAL 6 HOUR);
其中- INTERVAL 6 HOUR);的加减号和数字根据自己的情况改动。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants