php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27774 Bug in strtotime calculation (bissextile year ?)
Submitted: 2004-03-30 07:14 UTC Modified: 2004-03-30 07:33 UTC
From: eparis at plurimedia dot fr Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: Linux Debian / Solaris ... any
Private report: No CVE-ID: None
 [2004-03-30 07:14 UTC] eparis at plurimedia dot fr
Description:
------------
 Since today (2004-03-30), we experience a calculation error when using strtotime("-1 month") to get previous month date. Maybe this error is due to the fact that 2004 is a bissextile year. The last bissextile year was 1996.

Reproduce code:
---------------
 The actual computer date must be 2004-03-30.

<?
  print strftime("%Y-%m-%d", strtotime("-1 month"))."\n";
?>

Expected result:
----------------
2004-02-29

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-30 07: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

march 30 - 1 month = feb 30; that doesn\'t exist and is the same as march 1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC