The following PHP code shows Moscow time an hour more than it actually is:

date_default_timezone_set('UTC'); echo date('H:i:s'), '<br>'; date_default_timezone_set('Europe/Moscow'); echo date('H:i:s'); 

Displays:

 13:24:57 17:24:57 

System time on the server in UTC.

But at the same time, the time of Ekaterinburg (GMT + 6) is shown correctly.

What can be wrong? Thank!

  • one
    the fact is that the tandem is experimenting with time, and php do not have time to rule. I set the date.timezone = "Etc/GMT-3" - it works. And at 5.6 everything is already fine - splash58
  • @ splash58 lovers of experimenting :) - Vasily Barbashev

2 answers 2

You just need to update the time zone database - PECL package timezonedb .

Direct link to download the latest version.

    Try updating the version of php> 5.5.18. Judging by the tests in it, this bug is fixed:

    https://3v4l.org/Ed67N