Bug #67722 [NEW]: first day returning first day of next month

From: Date: Thu, 31 Jul 2014 09:25:39 +0000
Subject: Bug #67722 [NEW]: first day returning first day of next month
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186902@lists.php.net to get a copy of this message
From:             fabio at app-roved dot com
Operating system: SLES 11
PHP version:      5.5.15
Package:          Date/time related
Bug Type:         Bug
Bug description:first day returning first day of next month

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 bug report at https://bugs.php.net/bug.php?id=67722&edit=1
-- 



Thread (1 message)

  • fabio at app-roved dot com
« previous php.bugs (#186902) next »