|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesphp-datetime-bug54851.diff-v2 (last revision 2011-05-20 09:02 UTC by mats dot lindh at gmail dot com)php-datetime-bug54851.diff (last revision 2011-05-19 12:58 UTC by mats dot lindh at gmail dot com) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-05-19 15:00 UTC] mats dot lindh at gmail dot com
[2011-06-12 02:13 UTC] felipe@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: derick
[2011-11-26 16:44 UTC] derick@php.net
[2011-11-26 16:44 UTC] derick@php.net
[2011-11-26 16:44 UTC] derick@php.net
-Status: Assigned
+Status: Closed
[2011-12-06 05:59 UTC] derick@php.net
[2012-04-18 09:47 UTC] laruence@php.net
[2012-07-24 23:38 UTC] rasmus@php.net
[2013-11-17 09:34 UTC] laruence@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
Description: ------------ If the format only includes a day string ('D' or 'l'), it is ignored, and a DateTime instance for the current date/time is returned. Maybe I'm a stupid idiot, but I would expect either an error, or for it to return a DateTime object for the next occurrence of the given day (similar to \DateTime::__construct('Monday');) Test script: --------------- <?php $date = new \DateTime('tomorrow'); $date2 = \DateTime::createFromFormat('D', $date->format('D')); var_dump($date); var_dump($date->format('D')); var_dump($date2); var_dump($date2->format('D')); Expected result: ---------------- I expect the same date/day to be selected in both cases. Actual result: -------------- object(DateTime)#1 (3) { ["date"]=> string(19) "2011-05-19 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" } string(3) "Thu" object(DateTime)#2 (3) { ["date"]=> string(19) "2011-05-18 18:49:33" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" } string(3) "Wed"