Bug #52290 [Asn->Csd]: setDate, setISODate, setTime works wrong when DateTime created from timestamp
| From: | stas@php.net | Date: | Sun, 30 Jan 2011 10:18:34 +0000 |
| Subject: | Bug #52290 [Asn->Csd]: setDate, setISODate, setTime works wrong when DateTime created from timestamp | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158332@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52290&edit=1
ID: 52290
Updated by: stas@php.net
Reported by: danikas2k2 at gmail dot com
Summary: setDate, setISODate, setTime works wrong when
DateTime created from timestamp
-Status: Assigned
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: WinXP x86
PHP Version: 5.3.2
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-01-30 11:18:14] stas@php.net
Automatic comment from SVN on behalf of stas
Revision: http://svn.php.net/viewvc/?view=revision&revision=307853
Log: Fix bug #52290 (setDate, setISODate, setTime works wrong when
DateTime created from timestamp)
------------------------------------------------------------------------
[2010-07-17 23:57:18] k.schroeder@php.net
Automatic comment from SVN on behalf of k.schroeder
Revision: http://svn.php.net/viewvc/?view=revision&revision=301357
Log: Test for #52290
------------------------------------------------------------------------
[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