php.net |  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
Votes:1
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
Description:
------------
The documentation of "first day" says "Sets the day of the first of the current month." (http://php.net/manual/de/datetime.formats.relative.php), 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 (https://bugs.php.net/bug.php?id=53778)

Test script:
---------------
<?php

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

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

?>

Expected result:
----------------
201407
201407

Actual result:
--------------
201407
201408

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-31 12:11 UTC] salathe@php.net
-Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: salathe
 [2014-07-31 12:11 UTC] salathe@php.net
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] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=334439
Log: start a changelog for datetime.formats.relative (doc bug #67722)
 [2014-07-31 13:37 UTC] salathe@php.net
-Status: Assigned +Status: Closed
 [2014-07-31 13:37 UTC] salathe@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-07-31 13:37 UTC] salathe@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC