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

 ID:               52290
 Updated by:       [email protected]
 Reported by:      danikas2k2 at gmail dot com
 Summary:          setDate, setISODate, setTime works wrong when DateTime
                   created from timestamp
-Status:           Open
+Status:           Assigned
 Type:             Bug
 Package:          Date/time related
 Operating System: WinXP x86
 PHP Version:      5.3.2
-Assigned To:      
+Assigned To:      derick



Previous Comments:
------------------------------------------------------------------------
[2010-07-08 15:29:29] danikas2k2 at gmail dot com

Description:
------------
setDate, setISODate, setTime works wrong

Test script:
---------------
$tz = 'UTC';

date_default_timezone_set($tz);



$ts = strtotime('2006-01-01');

$dt = new DateTime('@'.$ts);

$dt->setTimezone(new DateTimeZone($tz));



echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



$dt->setISODate(2005, 52, 1);

echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



$dt->setDate(2007, 10, 10);

echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



$dt->setTime(20, 30, 40);

echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



Expected result:
----------------
2005-W52-7 | 2006-01-01 | 00:00:00

2005-W52-1 | 2005-12-26 | 00:00:00

2007-W40-5 | 2007-10-10 | 00:00:00

2007-W40-5 | 2007-10-10 | 20:30:40



Actual result:
--------------
2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600

2041-W52-4 | 2041-12-26 | 00:00:00 | 2271628800

2044-W40-1 | 2044-10-03 | 00:00:00 | 2359065600

2081-W39-6 | 2081-09-27 | 20:30:40 | 3526230640




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



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

Reply via email to