|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-19 21:33 UTC] salathe@php.net
-Status: Open
+Status: Bogus
[2011-11-19 21:33 UTC] salathe@php.net
[2011-11-20 00:22 UTC] marcingronowski at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 21:00:01 2025 UTC |
Description: ------------ Incorrect data is generated by function DateTime::__construct in case of using the relative definition of time. If you use the command "last day of month" the previous month will be returned. If you use the command "first day of month" the correct month will be returned and second day in the month will be returned. Test script: --------------- $datea = new DateTime('last day October 2011'); echo $datea->format('Y-F-d'); $dateb = new DateTime('last monday October 2011'); echo $dateb->format('Y-F-d'); $datec = new DateTime('first day October 2011'); echo $datec->format('Y-F-d'); $datec = new DateTime('first day November 2011'); echo $datec->format('Y-F-d'); Expected result: ---------------- 2011-October-30 2011-October-30 2011-October-01 2011-November-01 Actual result: -------------- 2011-September-30 2011-September-26 2011-October-02 2011-November-02