php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27195 strtotime problems
Submitted: 2004-02-09 12:21 UTC Modified: 2004-02-09 12:33 UTC
From: sinner_zero at hotmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.4 OS: Linux 2.4.19
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: sinner_zero at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-02-09 12:21 UTC] sinner_zero at hotmail dot com
Description:
------------
Calling strtotime("-1 month",$date)
when
$date = march 30th
returns March 1st instead of february 30th (which actually doesn't exist in 2004), I would assume this means it should return February 29th or something close.

Reproduce code:
---------------
<?php
$date = date("2004-03-30");

$previousMonth = date("Y-m-d",strtotime("-1 month",strtotime($date)));

echo $previousMonth;
?>

Expected result:
----------------
2004-02-??

?? could be anything between 01 and 29.


Actual result:
--------------
2004-03-01


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-09 12:33 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

Already reported before too, but it is correct like this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 14:01:29 2024 UTC