php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76397 -n month is not sequential
Submitted: 2018-05-31 15:58 UTC Modified: 2018-05-31 16:03 UTC
From: i at cmsis dot me Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.6.36 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
26 - 24 = ?
Subscribe to this entry?

 
 [2018-05-31 15:58 UTC] i at cmsis dot me
Description:
------------
on 05-31 run strtotime('-1 month') and strtotime('-2 month') the month is not sequential

Test script:
---------------
echo date('Y-m-d H:i:s', strtotime('-1 month')) . "\n";
echo date('Y-m-d H:i:s', strtotime('-2 month')) . "\n";

Expected result:
----------------
the month should be sequential

Actual result:
--------------
-1 month for 05
and -2 month for 03

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-31 16:03 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-05-31 16:03 UTC] requinix@php.net
May 31st - 1 month = April 31st which doesn't exist and so overflows to May 1st.
May 31st - 2 months = March 31st which does exist.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 03:01:28 2024 UTC