Search code examples
phpdatetimesystem

PHP wrong date/time


PHP date() & time() return incorrect time:

When date.timezone = "Europe/Riga" the time returned by date() was 03-12-2011 08:57:12, but system time was 03-12-2011 01:57:12 (timezone Europe/Riga - correct time at that moment). When I changed timezone to "Europe/London", the time changed to 03-12-2011 06:57:12 ( actual time 02-12-2011 23:57:12 )

Time returned by date / hwclock --show was correct (03-12-2011 01:57:12 with system timezone set as Riga)

OS: Debian 6.0

I have checked most of the questions regarding similar issues on SO/Google, but they all seem to have wrong timezone specified.

As far as I can tell there is problem between php -> os. Of course, because the incorrect time offset is always constant I could subtract difference, but it is not a proper solution.

Any ideas will be greatly appreciated.


Solution

  • The problem looks similar to what I have seen on one of my servers. Looks to like bug in php 5.3.2-1. Try to run the php script in the bug report and post your results.