php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31661 strtotime does not parse dates before 1-1-1970
Submitted: 2005-01-23 07:07 UTC Modified: 2005-01-23 07:10 UTC
From: gregorylee at contractweb dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.8 OS: WinXP
Private report: No CVE-ID: None
 [2005-01-23 07:07 UTC] gregorylee at contractweb dot net
Description:
------------
strtotime still fails (as of version 4.3.8) to appropriately parse dates prior to 1-1-1970 in Windows builds. Reproducable with dates in various formats: MM/DD/YYYY, DD/MM/YYYY, YYYY-MM-DD.

Validation/conversion of dates prior to 1970 are frequently needed for applications that accept user input for birthdates. 


Reproduce code:
---------------
print strtotime('04/28/1964');
print strtotime('4/28/64');
print strtotime('1964-04-28');
print strtotime('28/4/1964');

Expected result:
----------------
expect timestamps with the appropriate value (instead of -1);

Actual result:
--------------
-1
-1
-1
-1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-23 07:10 UTC] sniper@php.net
RTFM: http://www.php.net/strtotime

"Additionally, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems."

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 16:01:30 2024 UTC