Reputation: 3529
When I try to format date from one timezone to same timezone I get wrong time (differenced by 1 hour). My code is:
$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);
Expected time is 14:00
, but 15:00
returns.
UPDATE: When I display year 2013 or 2014 everything is ok! What happens in 2015?
UPDATE2: +1 hour added from 26 october 2014. Its time when Russia goes to eternal winter time. Ok. But... how to format correctly?
Upvotes: 6
Views: 1125
Reputation: 39
I use directly 'GMT+03:00' instead 'Europe/Moscow'. Apparently the developers of the library do not have time for lawmakers.
Upvotes: 3
Reputation: 3529
If you have same problem, update icu (International Components for Unicode) at your OS.
Upvotes: 2
Reputation: 212
Check your php.ini
file for date.timezone
and make sure its set to
date.timezone = "Europe/Moscow"
Upvotes: 0