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

 ID:               52142
 Updated by:       tony2...@php.net
 Reported by:      riccardo at mercuriosistemi dot com
 Summary:          using diff change the datetime object
-Status:           Open
+Status:           Assigned
 Type:             Bug
 Package:          Date/time related
 Operating System: slackware
 PHP Version:      5.3.2
-Assigned To:      
+Assigned To:      derick



Previous Comments:
------------------------------------------------------------------------
[2010-06-22 12:40:46] riccardo at mercuriosistemi dot com

Description:
------------
A DateTime object with timezone_type=1 is always set to timezone=+00:00
after the use of diff

Test script:
---------------
date_default_timezone_set( "Europe/Rome" );



$da = new DateTime('2010-06-22T00:00:00+02:00');

$a = new DateTime('2010/06/23');



print_r($da);



$da->diff($a);

// $da has been changed

print_r($da);

Expected result:
----------------
DateTime Object

(

    [date] => 2010-06-22 00:00:00

    [timezone_type] => 1

    [timezone] => +02:00

)

DateTime Object

(

    [date] => 2010-06-21 22:00:00

    [timezone_type] => 1

    [timezone] => +02:00

)



Actual result:
--------------
DateTime Object

(

    [date] => 2010-06-22 00:00:00

    [timezone_type] => 1

    [timezone] => +02:00

)

DateTime Object

(

    [date] => 2010-06-21 22:00:00

    [timezone_type] => 1

    [timezone] => +00:00

)




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



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

Reply via email to