Bug->Doc #67722 [Opn]: first day returning first day of next month

From: Date: Thu, 31 Jul 2014 12:11:23 +0000
Subject: Bug->Doc #67722 [Opn]: first day returning first day of next month
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11403@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67722&edit=1 ID: 67722 Updated by: salathe@php.net Reported by: fabio at app-roved dot com Summary: first day returning first day of next month Status: Open -Type: Bug +Type: Documentation Problem Package: Date/time related Operating System: SLES 11 PHP Version: 5.5.15 -Assigned To: +Assigned To: salathe Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2014-07-31 09:25:38] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67722&edit=1

« previous php.doc.bugs (#11403) next »