Skip to content

Instantly share code, notes, and snippets.

@meglio
Created March 24, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meglio/a4017d3b52f1552fc782 to your computer and use it in GitHub Desktop.
Save meglio/a4017d3b52f1552fc782 to your computer and use it in GitHub Desktop.
<?php
$now = time();
$locales = `locale -a`;
$locales = preg_split('/\s/is', $locales);
//var_dump($locales); exit;
echo "<ul>";
foreach ($locales as $loc) {
$loc = trim($loc);
if (empty($loc)) {
continue;
}
if (strpos($loc, '.') !== false) {
continue;
}
setlocale(LC_ALL, $loc);
$formattedDate = strftime('%x', $now);
echo "<li>";
echo $loc . ': <strong>' . $formattedDate . '</strong>';
echo "</li>";
}
echo "</ul>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment