From: tj at systisoft dot com Operating system: Mac OS X PHP version: 5.3CVS-2008-07-18 (CVS) PHP Bug Type: Date/time related Bug description: Inconsistent behavior of the u format char
Description: ------------ The u format char behaves inconsistent. 1. In output the it uses 6 digits. When used in date_create_from_format it recognizes only up to 5 digits (though microseconds would be 6). So date_create_from_format('m-d-Y H:i:s T', $dateTime->format('m-d-Y H:i:s T')); will generate an error. 2. Though DateTime does not support microseconds (or does it?) and should cut them off it behaves very strange when parsing a date with fractional seconds. Reproduce code: --------------- $d = date_create_from_format("m-d-Y H:i:s.u T", "03-15-2005 12:22:29.00000 PST"); echo $d->format("m-d-Y H:i:s.u T"); $d = date_create_from_format("m-d-Y H:i:s.u T", "03-15-2005 12:22:29.00100 PST"); echo $d->format("m-d-Y H:i:s.u T"); Expected result: ---------------- 03-15-2005 12:22:29.00000 PST 03-15-2005 12:22:29.00000 PST Actual result: -------------- 03-15-2005 12:22:29.000000 PST 03-15-2005 12:22:29.100000000 PST -- Edit bug report at http://bugs.php.net/?id=45554&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45554&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45554&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45554&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45554&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45554&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45554&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45554&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45554&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45554&r=support Expected behavior: http://bugs.php.net/fix.php?id=45554&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45554&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45554&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45554&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45554&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45554&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45554&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45554&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45554&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45554&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45554&r=mysqlcfg