Differences

This shows you the differences between two versions of the page.

Link to this comparison view

date_localization [2011/06/09 12:46]
date_localization [2011/06/09 12:46] (current)
Line 1: Line 1:
 +===== Date Localization =====
 +You can localize the date and time within PHP by following these steps:
  
 +1. Verify that the correct locales are installed on the server.
 +<code bash>
 +> locale -a
 +aa_DJ
 +aa_DJ.iso88591
 +aa_DJ.utf8
 +aa_ER
 +aa_ER@saaho
 +aa_ER.utf8
 +aa_ER.utf8@saaho
 +aa_ET
 +...
 +</​code>​
 +2. Set the locale within PHP.
 +<code php>
 +setlocale(LC_TIME,​ '​fr_FR'​);​
 +</​code>​
 +3. Call strftime() to output the localized date.
 +<code php>
 +echo strftime('​%e %B %Y');
 +</​code>​