当我尝试将日期从一个时区格式化为同一时区时,我得到了错误的时间(相差 1 小时)。我的代码是:
$formatter = new IntlDateFormatter(
'ru_RU',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Moscow'
);
$date = new DateTime("2015-07-29 14:00:00", new DateTimeZone('Europe/Moscow'));
echo $formatter->format($date);
Run Code Online (Sandbox Code Playgroud)
预期时间为14:00
,但15:00
返回。
更新:当我显示 2013 年或 2014 年时,一切正常!2015 年会发生什么?
更新 2:从 2014 年 10 月 26 日起增加了 1 小时。现在是俄罗斯进入永恒冬季的时候。好的。但是...如何正确格式化?
归档时间: |
|
查看次数: |
834 次 |
最近记录: |