Displaying Times and Dates in Other Languages : setlocale « Utility Function « PHP






Displaying Times and Dates in Other Languages

 
<?php
  $ts = mktime();
  echo '<p>' . date('r (T)', $ts) . "</p>\n";

  if($loc_de = setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu'))
  {
    echo "<p>Preferred locale for German on this system is \"$loc_de\".<br />";
    echo 'Guten Morgen! Heute ist ' . strftime('%A %d %B %Y, %H.%M Uhr', $ts) 
    . ".</p>\n";
  }
  else
    echo "<p>Sorry! This system doesn't speak German.</p>\n";
?>
  
  








Related examples in the same category

1.Setting a default locale
2.Setting a default locale based on system environment
3.Setlocale() Options
4.Generating Localized GMT/UTC Time and Date Strings
5.setlocale(LC_MONETARY, 'en_DK');
6.setlocale(LC_MONETARY, 'en_US');
7.Preferred locale for Chinese
8.Preferred locale for German
9.Preferred locale for Russian
10.To report local time for any Germans