From: daniel dot oconnor at gmail dot com Operating system: All PHP version: 5.2.2 PHP Bug Type: Date/time related Bug description: strtotime does not parse australian style dates correctly
Description: ------------ Australians tend to do dates in dd/mm/yyyy format, rather than mm/dd/yyyy strtotime cannot handle this when the seperator is a '/', but can for '-' and '.' PHP should either: * Use consistent parsing all the way through. It should not matter if I pick a '-', '/' or '.' * Provide me an argument or configuration setting with which I can change the default behaviour. See http://en.wikipedia.org/wiki/Calendar_date#Date_format for a list of countries which use dd/mm/yyyy as a default, compared to a list of those who use mm/dd/yyyy. Reproduce code: --------------- <?php print phpversion() . "\n\n"; $times = array(); $times[] = '1-10-2007'; $times[] = '1/10/2007'; $times[] = '1.10.2007'; $times[] = '13-10-2007'; $times[] = '13/10/2007'; $times[] = '13.10.2007'; $times[] = '2007-10-10'; $times[] = '2007/10/10'; $times[] = '2007.10.10'; $times[] = '13-13-2007'; $times[] = '13/13/2007'; $times[] = '13.13.2007'; foreach ($times as $time) { print $time ."\n\t" . strtotime($time) . "\n\t" . date('Y-m-d H:i:sa', strtotime($time)) . "\n\n"; } Expected result: ---------------- ---------- php ---------- 5.2.2 1-10-2007 1191196800 2007-10-01 00:00:00am 1/10/2007 1168387200 2007-01-10 00:00:00am 1.10.2007 1191196800 2007-10-01 00:00:00am 13-10-2007 1192233600 2007-10-13 00:00:00am 13/10/2007 1192233600 2007-10-13 00:00:00am 13.10.2007 1192233600 2007-10-13 00:00:00am 2007-10-10 1191974400 2007-10-10 00:00:00am 2007/10/10 1191974400 2007-10-10 00:00:00am 2007.10.10 1970-01-01 00:00:00am 13-13-2007 1970-01-01 00:00:00am 13/13/2007 1970-01-01 00:00:00am 13.13.2007 1970-01-01 00:00:00am Output completed (0 sec consumed) - Normal Termination Actual result: -------------- ---------- php ---------- 5.2.2 1-10-2007 1191196800 2007-10-01 00:00:00am 1/10/2007 1168387200 2007-01-10 00:00:00am 1.10.2007 1191196800 2007-10-01 00:00:00am 13-10-2007 1192233600 2007-10-13 00:00:00am 13/10/2007 1970-01-01 00:00:00am 13.10.2007 1192233600 2007-10-13 00:00:00am 2007-10-10 1191974400 2007-10-10 00:00:00am 2007/10/10 1191974400 2007-10-10 00:00:00am 2007.10.10 1970-01-01 00:00:00am 13-13-2007 1970-01-01 00:00:00am 13/13/2007 1970-01-01 00:00:00am 13.13.2007 1970-01-01 00:00:00am Output completed (0 sec consumed) - Normal Termination -- Edit bug report at http://bugs.php.net/?id=41335&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41335&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41335&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41335&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41335&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41335&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41335&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41335&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41335&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41335&r=support Expected behavior: http://bugs.php.net/fix.php?id=41335&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41335&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41335&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41335&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41335&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41335&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41335&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41335&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41335&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41335&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41335&r=mysqlcfg
