|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-31 08:44 UTC] brooksie155 at yahoo dot com
Description:
------------
There is a bug in the constructor of this object if you are only specifying the month and the year when dealing with the month of February.
Reproduce code:
---------------
$date = new DateTime('2009-02');
echo $date->format('Y-m');
Expected result:
----------------
2009-02
Actual result:
--------------
2009-03
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
The output from your script on my box: America/Los_Angeles array(12) { ["year"]=> int(2009) ["month"]=> int(2) ["day"]=> bool(false) ["hour"]=> bool(false) ["minute"]=> bool(false) ["second"]=> bool(false) ["fraction"]=> bool(false) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) } 2009-03-03T00:00:00-0800 That 'false' there on the date will make it default to today's date. Seeing it on both 5.2 and 5.3 on Freebsd.