PHP 当地时间 - 1 小时


PHP localtime - 1 hour

如何获取当地时间 - 1 小时?

我可以得到 UTC 时间 - 1 小时与 strtotime('-1 hour') ,但我想要相当于当地时间。

好的,问题解决了大家。谢谢

你记得提前设置当地时间吗?

http://php.net/manual/en/function.date-default-timezone-set.php

根据

本地环境时区使用PHP的设置时区预定义函数并应用strtotime函数