#46268 [Opn->Asn]: When call DateTime#setTime, it seems to be called the last modify method too
| From: | felipe@php.net | Date: | Fri, 10 Oct 2008 18:43:56 +0000 |
| Subject: | #46268 [Opn->Asn]: When call DateTime#setTime, it seems to be called the last modify method too | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129613@lists.php.net to get a copy of this message | ||
ID: 46268
Updated by: felipe@php.net
Reported By: shimooka at doyouphp dot jp
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: CentOS5.2, WindowsXP(SP3)
PHP Version: 5.3.0alpha2
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2008-10-10 04:27:11] shimooka at doyouphp dot jp
Description:
------------
When I call DateTime#setTime, it seems to be called the last modify
method too. If I use date_time_set function, I get the same result.
This report is similar to Bug #41599, but differ from #41599 in using
'time'(01:02:03).
With PHP5.2.6, I get the expected result.
Reproduce code:
---------------
<?php
date_default_timezone_set('Asia/Tokyo');
$now = new DateTime('2008-10-10 01:02:03');
echo $now->format("Y-m-d H:i:s") . PHP_EOL;
$now->modify("1 day after");
echo $now->format("Y-m-d H:i:s") . PHP_EOL;
$now->modify("1 hour after");
echo $now->format("Y-m-d H:i:s") . PHP_EOL;
$now->setTime(0, 0, 0);
//date_time_set($now, 0, 0, 0);
echo $now->format("Y-m-d H:i:s") . PHP_EOL;
Expected result:
----------------
2008-10-10 01:02:03
2008-10-11 01:02:03
2008-10-11 02:02:03
2008-10-11 00:00:00
Actual result:
--------------
2008-10-10 01:02:03
2008-10-11 01:02:03
2008-10-11 02:02:03
2008-10-11 01:00:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46268&edit=1