View Problem

Display a date in different locales

Display a language/locale friendly version of New Year's Day for 2009 for several languages/locales. E.g. for languages English, French, German, Italian, Dutch the output might be something like:

Thursday, January 1, 2009
jeudi 1 janvier 2009
giovedì 1 gennaio 2009
Donnerstag, 1. Januar 2009
donderdag 1 januari 2009

(Indicate in comments where possible if any language specific or operating system configuration needs to be in place.)
ExpandDiskEdit
php
/* Be aware of that you need to have the locales installed */
setlocale(LC_TIME, "en_US");
echo strftime("%A, %B %e, %Y%n"); // %n = \n in strftime()
setlocale(LC_TIME, "fr_FR"); // French
echo strftime("%A, %B %e, %Y%n");
setlocale(LC_TIME, "de_DE"); // German
echo strftime("%A, %B %e, %Y%n");
setlocale(LC_TIME, "it_IT"); // Italian
echo strftime("%A, %B %e, %Y%n");
setlocale(LC_TIME, "nl_NL", "nld_nld"); // Dutch; Unix and Windows
echo strftime("%A, %B %e, %Y%n");
ExpandDiskEdit
php
$locales = array("en_US", "fr_FR", "de_DE", "nl_NL", "it_IT");
foreach ($locales as $locale) {
setlocale(LC_TIME, $locale);
echo strftime("%A, %B %d %Y%n");
}
ExpandDiskEdit
clojure
(let [time (.getTime (GregorianCalendar. 2009 Calendar/JANUARY 1))]
(doseq [locale ["en" "fr" "it" "de" "nl"]]
(println (.format (DateFormat/getDateInstance DateFormat/FULL
(Locale. locale))
time))))
DiskEdit
fantom
// May require modification of Fantom distribution t
// for undefined locales - basically just create a '<locale-name>.props' plain text file with values like this:
// sunAbbr=Sun
// ..
// sunFull=Sunday
["en", "fr", "ru"].map { Locale(it) }.each |Locale l| {
l.use { echo(Date(2009, Month.jan, 1).toLocale("WWWW, MMMM D, YYYY")) }
}

Submit a new solution for php, clojure, or fantom
There are 8 other solutions in additional languages (cpp, csharp, fsharp, groovy ...)