|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2006-12-09 15:28 UTC] iliaa@php.net
  [2006-12-11 21:09 UTC] iliaa@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 06:00:01 2025 UTC | 
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