php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36396 strtotime() fails to parse dates in dd-mm-yyyy format
Submitted: 2006-02-15 02:54 UTC Modified: 2006-02-24 10:45 UTC
From: todd dot farrell at linkmarketservices dot com dot au Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.1.2 OS: Win32 / Solaris 8
Private report: No CVE-ID: None
 [2006-02-15 02:54 UTC] todd dot farrell at linkmarketservices dot com dot au
Description:
------------
Specifiying a date in the format 31/12/2005 fails to parse however the American format 12/31/2005 works.

This works in PHP 5.0.4 on Solaris 8 but no longer works with the strtotime() changes in 5.1.2.

Some more testing revealed that various formats do not work when the day precedes the month e.g. 31-12-2005 that used to work in 5.0.4.

(We are aware that this does not necessarily produce sensible results e.g. strtotime("31/12/2005") != strtotime("12/31/2005") even in 5.0.4 although it seems that it should at least still *work* in the same way...)

If you need any more information please let me know.

Reproduce code:
---------------
<?php

print strtotime("31/12/2005");

?>

Expected result:
----------------
1184162400

Actual result:
--------------
nothing

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-15 08:50 UTC] derick@php.net
31/12/2005 is not supposed to work. It's not a valid format. However, I will see why 31-12-2005 doesn't work.
 [2006-02-24 10:45 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Support for dd-mm-yyyy has been readded.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC