Why does PHP IntlDateFormatter return an invalid date? +1 hour

When I try to format a date from one time zone to the same time zone, I get the wrong time (different for 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); 

The expected time is 14:00 , but 15:00 returned.

UPDATE . When I show 2013 or 2014, everything is in order! What will happen in 2015?

UPDATE2 : +1 hour added since October 26, 2014. The time when Russia goes to eternal winter time. OK. But ... how to format?

+4
source share
3 answers

If you have the same problem, update icu (International Components for Unicode) on your OS.

+2
source

I use directly 'GMT + 03: 00' instead of 'Europe / Moscow'. Apparently, the developers of the library do not keep up with the legislators.

+3
source

Check the php.ini file date.timezone and make sure its value is set to

date.timezone = "Europe/Moscow"

0
source

All Articles