|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67722 first day returning first day of next month
Submitted: 2014-07-31 09:25 UTC Modified: 2014-07-31 13:37 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: fabio at app-roved dot com Assigned: salathe (profile)
Status: Closed Package: Date/time related
PHP Version: 5.5.15 OS: SLES 11
Private report: No CVE-ID: None
 [2014-07-31 09:25 UTC] fabio at app-roved dot com
The documentation of "first day" says "Sets the day of the first of the current month." (, but it will return sometimes the first day of the next month.

For 2014-07-30 it returns 2014-07-01
For 2014-07-31 it returns 2014-08-01
For 2014-08-01 it returns 2014-08-01

There's a related bug which fixed a similiar issue in PHP 5.3 (

Test script:

$currentMonthDate = new DateTime("2014-07-31 10:26:00.000000");
echo $currentMonthDate->format('Ym');

$currentMonthDate->modify('first day');
echo $currentMonthDate->format('Ym');


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-31 12:11 UTC]
-Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: salathe
 [2014-07-31 12:11 UTC]
From Derick in bug #51096:
    "first day" and "last day" should be "+1 day" and "-1 day".

The documentation should be updated to reflect this behaviour, as currently the "first/last day of" section says the "of" is optional when it is not.
 [2014-07-31 13:11 UTC]
Automatic comment from SVN on behalf of salathe
Log: start a changelog for datetime.formats.relative (doc bug #67722)
 [2014-07-31 13:37 UTC]
-Status: Assigned +Status: Closed
 [2014-07-31 13:37 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2014-07-31 13:37 UTC]
Grr wrong "quick fix" message again! Here's what it should have said:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

And, thanks again!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 11 02:01:23 2021 UTC