#37514 [NEW]: strtotime doesn't assume year correctly

From: Date: Thu, 18 May 2006 22:43:03 +0000
Subject: #37514 [NEW]: strtotime doesn't assume year correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97349@lists.php.net to get a copy of this message
From: pcavit at gmail dot com Operating system: FreeBSD 6 PHP version: 5.1.4 PHP Bug Type: Date/time related Bug description: strtotime doesn't assume year correctly Description: ------------ When using strtotime to parse dates if an 'am' or 'pm' is added without specifying a year false will be returned. Reproduce code: --------------- echo date('r', strtotime('May 18th 5:05')); echo date('r', strtotime('May 18th 5:05pm')); echo date('r', strtotime('May 18th 5:05 pm')); echo date('r', strtotime('May 18th 5:05am')); echo date('r', strtotime('May 18th 5:05 am')); echo date('r', strtotime('May 18th 2006 5:05pm')); Expected result: ---------------- Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Actual result: -------------- Thu, 18 May 2006 05:05:00 -0700 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Thu, 18 May 2006 17:05:00 -0700 -- Edit bug report at http://bugs.php.net/?id=37514&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37514&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37514&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37514&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37514&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37514&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37514&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37514&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37514&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37514&r=support Expected behavior: http://bugs.php.net/fix.php?id=37514&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37514&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37514&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37514&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37514&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37514&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37514&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37514&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37514&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37514&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37514&r=mysqlcfg

« previous php.bugs (#97349) next »