Home » Date and Time » Date » Bug #3022
Abbreviations of Weekday (and Month)
Details
| Submitted | 2004-12-23 15:15 UTC |
|---|---|
| From | bruno dot baketaric at email dot de |
| Assigned | pajoye |
| Status | Closed |
| Package | Date |
| PHP Version | 4.3.9 |
| OS | independent |
| Roadmaps | (Not assigned) |
Comments
[2004-12-23 15:15 UTC] bruno dot baketaric at email dot de
Description:
------------
The abbreviation length cannot be set using Date::format(), it always defaults to 3 in Date_Calc::getWeekdayAbbrname(). This is wrong for i.e. German abbreviations of weekdays (Mo,Di,Mi...). One solution could be to set the length parameter according to the current locale. Another would be (and I did it this way), to add a method getWeekDaysAbbr() that uses strftime('%a',...) to Date_Calc and make getWeekdayAbbrname() use it.
I don't believe there are any side effects. Maybe the same applies to Month names (I don't know the abbreviations in all locales as good as strftime does ;-) ).
Reproduce code:
---------------
setlocale(LC_TIME,"de_DE");
$t = new Date();
echo($t->format('%a'));
Expected result:
----------------
Di
Actual result:
--------------
Die