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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: i at cmsis dot me
New email:
PHP Version: OS:

 

 [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: Thu Mar 28 20:01:28 2024 UTC