php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39139 Last month bug
Submitted: 2006-10-12 14:30 UTC Modified: 2007-04-13 14:12 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: faty at e-technics dot com Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.1.6 OS: OpenSUSE 10.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: faty at e-technics dot com
New email:
PHP Version: OS:

 

 [2006-10-12 14:30 UTC] faty at e-technics dot com
Description:
------------
Strtotime should subtract exactly one month if the parameter is "last month" or "-1 month". Instead it subtracts 30 days.

Reproduce code:
---------------
// 1149022800 is the timestamp for 31 may 2006
echo date('d/m/Y',strtotime('last month',1149022800));


Expected result:
----------------
30/04/2006

Actual result:
--------------
1/05/2006

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-13 14:12 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

No, it goes back to April 31st, which does not exist. (April only has 30 days). The first day after April 30th is May 1st.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 10:01:30 2025 UTC