php gmdate() 时区不正确
php gmdate() Incorrect time zone
当我使用:
echo gmdate("YmdHis O")
输出为:
20151211091805 +0000
但是在意大利现在是错误的10:00,为什么我的错误?
Identical to the date() function except that the time returned is Greenwich Mean Time (GMT).
如果您需要当地时间,请使用 date()
。
获取时间前设置时区
date_default_timezone_set ( string $timezone_identifier )
然后
echo gmdate("YmdHis O");
设置时区
date_default_timezone_set('Europe/Rome');
当我使用:
echo gmdate("YmdHis O")
输出为:
20151211091805 +0000
但是在意大利现在是错误的10:00,为什么我的错误?
Identical to the date() function except that the time returned is Greenwich Mean Time (GMT).
如果您需要当地时间,请使用 date()
。
获取时间前设置时区
date_default_timezone_set ( string $timezone_identifier )
然后
echo gmdate("YmdHis O");
设置时区
date_default_timezone_set('Europe/Rome');