ID: 44264
User updated by: kungla at gmail dot com
-Summary: wrong timezone
Reported By: kungla at gmail dot com
Status: Bogus
Bug Type: Date/time related
-Operating System: Win XP SP2
+Operating System: Win XP SP2 AND OSX Leopard
PHP Version: 5.2.5
New Comment:
No I tested this on OSX leopard - same issue. I did some more
examples.
Reproduce code:
---------------
<?php
date_default_timezone_set('Europe/Tallinn');
$date1 = new DateTime('02.01.1980', new
DateTimeZone('Europe/Tallinn'));
$date2 = new DateTime('02.01.1990', new
DateTimeZone('Europe/Tallinn'));
echo 'Date1<br/>';
echo $date1->format('c'). ' ' . $date1->getTimezone()->getName();
echo '<br/><br/>';
echo 'Date2<br/>';
echo $date2->format('c'). ' ' . $date2->getTimezone()->getName();
echo '<br/><br/>';
echo "date('c', strtotime('02.01.1980'))<br/>";
echo date('c', strtotime('02.01.1980'));
echo '<br/><br/>';
$date3 = new DateTime('-38 years', new
DateTimeZone('Europe/Tallinn'));
echo 'Date3<br/>';
echo $date3->format('c'). ' ' . $date3->getTimezone()->getName();
echo '<br/><br/>';
date_default_timezone_set('GMT');
echo "date('c', strtotime('02.01.1980')) with
date_default_timezone_set('GMT') and working<br/>";
echo date('c', strtotime('02.01.1980'));
?>
Expected result:
----------------
Date1
1980-01-02T00:00:00+02:00 Europe/Tallinn
Date2
1990-01-02T00:00:00+02:00 Europe/Tallinn
date('c', strtotime('02.01.1980'))
1980-01-02T00:00:00+02:00
Date3
1970-02-27T23:28:00+02:00 Europe/Tallinn
date('c', strtotime('02.01.1980')) with
date_default_timezone_set('GMT') and working
1980-01-02T00:00:00+00:00
Actual result:
--------------
Date1
1980-01-02T00:00:00+03:00 Europe/Tallinn
Date2
1990-01-02T00:00:00+02:00 Europe/Tallinn
date('c', strtotime('02.01.1980'))
1980-01-02T00:00:00+03:00
Date3
1970-02-27T23:28:00+03:00 Europe/Tallinn
date('c', strtotime('02.01.1980')) with
date_default_timezone_set('GMT') and working
1980-01-02T00:00:00+00:00
Previous Comments:
------------------------------------------------------------------------
[2008-02-27 13:56:58] [EMAIL PROTECTED]
The returned data is perfectly correct. From 1944 until 1981 Tallinn
used Moscow time with Daylight Savings Time.
Europe/Tallinn Thu Sep 21 22:00:00 1944 UTC = Fri Sep 22 01:00:00 1944
MSK isdst=0 gmtoff=10800
Europe/Tallinn Tue Mar 31 20:59:59 1981 UTC = Tue Mar 31 23:59:59 1981
MSK isdst=0 gmtoff=10800
>From 1981 to 1989 moscow timw with DST:
Europe/Tallinn Tue Mar 31 20:59:59 1981 UTC = Tue Mar 31 23:59:59 1981
MSK isdst=0 gmtoff=10800
Europe/Tallinn Tue Mar 31 21:00:00 1981 UTC = Wed Apr 1 01:00:00 1981
MSD isdst=1 gmtoff=14400
Europe/Tallinn Wed Sep 30 19:59:59 1981 UTC = Wed Sep 30 23:59:59 1981
MSD isdst=1 gmtoff=14400
Europe/Tallinn Wed Sep 30 20:00:00 1981 UTC = Wed Sep 30 23:00:00 1981
MSK isdst=0 gmtoff=10800
...
...
Europe/Tallinn Sat Sep 24 23:00:00 1988 UTC = Sun Sep 25 02:00:00 1988
MSK isdst=0 gmtoff=10800
Europe/Tallinn Sat Mar 25 22:59:59 1989 UTC = Sun Mar 26 01:59:59 1989
MSK isdst=0 gmtoff=10800
>From 1989 until now, Estonia switched to the non-russian zone with
DST:
Europe/Tallinn Sat Mar 25 23:00:00 1989 UTC = Sun Mar 26 02:00:00 1989
EEST isdst=1 gmtoff=10800
Europe/Tallinn Sat Sep 23 23:59:59 1989 UTC = Sun Sep 24 02:59:59 1989
EEST isdst=1 gmtoff=10800
Europe/Tallinn Sun Sep 24 00:00:00 1989 UTC = Sun Sep 24 02:00:00 1989
EET isdst=0 gmtoff=7200
Europe/Tallinn Sat Mar 24 23:59:59 1990 UTC = Sun Mar 25 01:59:59 1990
EET isdst=0 gmtoff=7200
Europe/Tallinn Sun Mar 25 00:00:00 1990 UTC = Sun Mar 25 03:00:00 1990
EEST isdst=1 gmtoff=10800
...
...
Europe/Tallinn Sun Mar 30 00:59:59 2008 UTC = Sun Mar 30 02:59:59 2008
EET isdst=0 gmtoff=7200
Europe/Tallinn Sun Mar 30 01:00:00 2008 UTC = Sun Mar 30 04:00:00 2008
EEST isdst=1 gmtoff=10800
Europe/Tallinn Sun Oct 26 00:59:59 2008 UTC = Sun Oct 26 03:59:59 2008
EEST isdst=1 gmtoff=10800
Europe/Tallinn Sun Oct 26 01:00:00 2008 UTC = Sun Oct 26 03:00:00 2008
EET isdst=0 gmtoff=7200
If you are 100% sure that this data is incorrect, and you can back that
up with proof, let me know.
------------------------------------------------------------------------
[2008-02-27 13:46:43] kungla at gmail dot com
Sorry class is DateTime not Time. Same issue with date('c', giventime)
------------------------------------------------------------------------
[2008-02-27 13:42:43] kungla at gmail dot com
Description:
------------
On some dates timezone goes wrong. Big problem for me - can't go on
whith my work!!!
Reproduce code:
---------------
$date1 = new Date('02.01.1980', new DateTimeZone('Europe/Tallinn'));
$date2 = new Date('02.01.1990', new DateTimeZone('Europe/Tallinn'));
echo $date1->format('c'). ' ' . $date2->format('c');
Expected result:
----------------
1980-01-02T00:00:00+02:00 1990-01-02T00:00:00+02:00
Actual result:
--------------
1980-01-02T00:00:00+03:00 1990-01-02T00:00:00+02:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44264&edit=1