Bug #78091 [Opn->Nab]: DateTime - subtraction of 1 month return first day of actual month
| From: | requinix@php.net | Date: | Fri, 31 May 2019 12:38:03 +0000 |
| Subject: | Bug #78091 [Opn->Nab]: DateTime - subtraction of 1 month return first day of actual month | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221059@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78091&edit=1
ID: 78091
Updated by: requinix@php.net
Reported by: jan dot zenisek at outlook dot com
Summary: DateTime - subtraction of 1 month return first day
of actual month
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Win 10 / Ubuntu Server
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Assuming you mean today is the 31st,
May 31 - 1 month = April 31, which overflows to May 1.
Previous Comments:
------------------------------------------------------------------------
[2019-05-31 11:27:36] jan dot zenisek at outlook dot com
Description:
------------
DateTime->modify
When I subtract 1 month from new DateTime (today is 5th May 2019), I got wrong Date (1st May 2019)
but I was expecting April.
Test script:
---------------
var_dump((new \DateTime())->modify('-1 months'));
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78091&edit=1