php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36899 strtotime fails to return null or false
Submitted: 2006-03-28 23:33 UTC Modified: 2006-03-29 18:44 UTC
From: alan dot whitney at sephone dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.2 OS: Linux (Fedora Core 2)
Private report: No CVE-ID: None
 [2006-03-28 23:33 UTC] alan dot whitney at sephone dot com
Description:
------------
When you use strtotime on 1143522000 it returns a timestamp 6 years eariler.

It seems to be if the string falls on the format HHMMSSYYYY and HH is above 10 and SS is above 37 it will parse it out to be the time in the string(HHMMSS), today's date and the year (YYYY) in the string.

Reproduce code:
---------------
$mktime = mktime(0,0,0, 3, 28, 2006);
$return = strtotime($mktime);
if ($return === false) { 
   echo "Nothing";
} else { 
   echo date("r", $return);
}

Expected result:
----------------
Nothing

Actual result:
--------------
Tue, 28 Mar 2000 11:43:52 -0500

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-28 23:41 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip

Can't reproduce.
 [2006-03-29 00:05 UTC] alan dot whitney at sephone dot com
I Downloaded and installed the latest snap shot.  It didn't seem to fix the problem.  When I run this code:

$mktime = 1143592000;
$return = strtotime($mktime);
echo $return;

I get the output of 954261839.  Which is a timestamp for 3/28/2000 at 11:43:59

I was expecting it to return false or null.
 [2006-03-29 18:44 UTC] iliaa@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 how it should work.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 08 13:00:03 2025 UTC