php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66243 Strtotime producing invalid result
Submitted: 2013-12-07 07:17 UTC Modified: 2013-12-07 07:30 UTC
From: elliottpost at gmail dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.4.22 OS: Ubuntu 12.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 43 = ?
Subscribe to this entry?

 
 [2013-12-07 07:17 UTC] elliottpost at gmail dot com
Description:
------------
Strtotime() is producing unusual numbering whether running on a server or a fresh install on localhost without modifying php.ini. 

Example given in the docs is "10 September 2000". 
strtotime("10 September 2000") works; however, it is a day off. I thought this is due to time zone issues, but when trying the below script it produces a result of December 12, 2000. More than 24 hours off--doesn't seem possible just because of time zones. The higher you go up, the further off it gets--but some work okay. I can't explain it, but I've listed a few samples below.

Test script:
---------------
<?php
echo date( "F n, Y", strtotime( "10 September 2000") ); //prints September 9, 2000
echo date( "F n, Y", strtotime( "10 December 2000") ); //prints December 12, 2000
echo date( "F n, Y", strtotime( "25 December 2013") ); //prints December 12, 2013
echo date( "F n, Y", strtotime( "2014-12-25") ); //prints December 12, 2013
echo date( "F n, Y", strtotime( "2014-05-05") ); //prints May 5, 2014
?>

Expected result:
----------------
I expected the time to be formatted correctly.

Actual result:
--------------
Please see the test-script...I've added comments by each echo statement.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-07 07:30 UTC] elliottpost at gmail dot com
-Status: Open +Status: Closed
 [2013-12-07 07:30 UTC] elliottpost at gmail dot com
I'm an idiot. n != day... Sorry!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC