ID: 39782
Updated by: [EMAIL PROTECTED]
Reported By: php at michaelho dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Max OS X 10.4.7
PHP Version: 5.2.0
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2006-12-08 22:40:42] php at michaelho dot com
Description:
------------
When calling setTime() on a DateTime that has been constructed with a
Weekday (e.g. new DateTime('Wednesday'))...
Calling setTime() causes the date to "jump" to the Next Sunday. This
happens on each and every call to setTime().
Reproduce code:
---------------
<?php
$dttTest = new DateTime('Next Wednesday');
print $dttTest->format('D M j Y - H:i:s') . '<br/>';
/* Correctly outputs: "Wed Dec 13 2006 - 00:00:00" */
$dttTest->setTime(12, 0, 0);
print $dttTest->format('D M j Y - H:i:s') . '<br/>';
/* EXPECTING: "Wed Dec 13 2006 - 12:00:00" */
/* ACTUAL: "Sun Dec 17 2006 - 12:00:00" */
$dttTest->setTime(12, 0, 0);
print $dttTest->format('D M j Y - H:i:s') . '<br/>';
/* EXPECTING: "Wed Dec 13 2006 - 12:00:00" */
/* ACTUAL: "Sun Dec 24 2006 - 12:00:00" */
?>
Expected result:
----------------
Wed Dec 13 2006 - 00:00:00
Wed Dec 13 2006 - 12:00:00
Wed Dec 13 2006 - 12:00:00
Actual result:
--------------
Wed Dec 13 2006 - 00:00:00
Sun Dec 17 2006 - 12:00:00
Sun Dec 24 2006 - 12:00:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39782&edit=1