php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34250 strtotime("next year") returns +2 years?
Submitted: 2005-08-25 17:42 UTC Modified: 2005-08-25 23:55 UTC
From: gecko at geckzilla dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.0.4 OS: Linux
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: gecko at geckzilla dot com
New email:
PHP Version: OS:

 

 [2005-08-25 17:42 UTC] gecko at geckzilla dot com
Description:
------------
Simply expecting for strtotime("next year") to return +1 year instead of +2.

Reproduce code:
---------------
$nextyear = strtotime("next year");
$now = time();

echo date("F jS Y",$nextyear);
echo "<br>";
echo date("F jS Y",$now);

Expected result:
----------------
August 25th 2006
August 25th 2005

Actual result:
--------------
August 25th 2007
August 25th 2005

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-25 23:55 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

This is expected for PHP < 5.1. In PHp 5.1 and 6.0 this will work just fine. The reasoning is that you have:
first = 1
next  = 2
third = 3
and follows the GNU standards. We did decide to fix this in PHP 5.1 though.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 09:01:30 2025 UTC