phpdatearabic

Display dates in Arabic


Here's my code:

setlocale( LC_ALL,'ar' ); 
echo strftime( '%e %b, %Y', strtotime( '2011-10-25' ));

Output:

25 Sep, 2011

Why is it not displaying the arabic date? Am I using strftime incorrectly?


Solution

  • AFAIK setlocale won't actually do any language translation for you but rather affects things like the formatting and comparator functionality. If you want localisation then you could try using IntlDateFormatter which may give you what you need.

    Updated: You could also try Zend_Date as suggested in this question if PHP 5.3 isn't an option for you.