ID:               45529
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tj at systisoft dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Date/time related
 Operating System: Mac OS X
 PHP Version:      5.3CVS-2008-07-16 (CVS)
-Assigned To:      
+Assigned To:      derick


Previous Comments:
------------------------------------------------------------------------

[2008-07-16 13:40:18] tj at systisoft dot com

Description:
------------
If you generate a DateTimeZone with new and one with
date_create()->getTimeZone, the resulting DateTimeZone objects behave
different even if the are of the same time zone.

Reproduce code:
---------------
$tz1 = new DateTimeZone('UTC');
$tz2 = date_create('UTC')->getTimeZone();
echo $tz1->getName(), PHP_EOL;
echo $tz2->getName(), PHP_EOL;
$d = new DateTime('2008-01-01 12:00:00+0200');
$d->setTimeZone($tz1);
echo $d->format(DATE_ISO8601), PHP_EOL;
$d = new DateTime('2008-01-01 12:00:00+0200');
$d->setTimeZone($tz2);
echo $d->format(DATE_ISO8601), PHP_EOL; 

Expected result:
----------------
UTC
UTC
2008-1-1T10:00:00+0000
2008-1-1T10:00:00+0000

Actual result:
--------------
UTC
UTC
2008-01-01T10:00:00+0000
PHP Warning:  DateTime::setTimezone(): Can only do this for zones with
ID for now in /Users/tobias/test.php on line 9

Warning: DateTime::setTimezone(): Can only do this for zones with ID
for now in /Users/tobias/test.php on line 9
2008-01-01T12:00:00+0200



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45529&edit=1

Reply via email to