From: sparky89 at gmx dot de Operating system: Debian PHP version: 5.2.10 PHP Bug Type: Feature/Change Request Bug description: DateTime should also use locales
Description: ------------ as of 5.2 there are features of DateTime class. http://de.php.net/datetime Im asking myself at the moment, why it does not look up locales. It is somehow stupid to use datetime, convert it to timestamp just to get an output of the month for any language, assuming strftime to convert the timestamp. I hope this will be changed. Reproduce code: --------------- <?php echo '<pre>'; $date1 = new DateTime('2009-07-07 13:20:12'); setlocale(LC_ALL, 'German'); var_dump(strftime('%A', $date1->format('U'))); var_dump($date1->format('l')); setlocale(LC_ALL, 'English'); var_dump(strftime('%A', $date1->getTimestamp())); var_dump($date1->format('l')); echo '</pre>'; highlight_file(__FILE__); ?> Expected result: ---------------- string(8) "Dienstag" string(7) "Dienstag" string(7) "Tuesday" string(7) "Tuesday" Actual result: -------------- string(8) "Dienstag" string(7) "Tuesday" string(7) "Tuesday" string(7) "Tuesday" -- Edit bug report at http://bugs.php.net/?id=48834&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48834&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48834&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48834&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48834&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48834&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48834&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48834&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48834&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48834&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48834&r=support Expected behavior: http://bugs.php.net/fix.php?id=48834&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48834&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48834&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48834&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48834&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48834&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48834&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48834&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48834&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48834&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48834&r=mysqlcfg