#48834 [Opn->Asn]: DateTime should also use locales
| From: | derick@php.net | Date: | Wed, 08 Jul 2009 08:26:29 +0000 |
| Subject: | #48834 [Opn->Asn]: DateTime should also use locales | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139464@lists.php.net to get a copy of this message | ||
ID: 48834
Updated by: derick@php.net
Reported By: sparky89 at gmx dot de
-Status: Open
+Status: Assigned
Bug Type: Feature/Change Request
Operating System: Debian
PHP Version: 5.2.10
-Assigned To:
+Assigned To: derick
New Comment:
This is indeed planned for PHP 6, where there is an experimental
function "date_format_locale()" alreadyâbut that is bound to change.
Previous Comments:
------------------------------------------------------------------------
[2009-07-07 12:41:59] sparky89 at gmx dot de
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 this bug report at http://bugs.php.net/?id=48834&edit=1