Skip to content

Instantly share code, notes, and snippets.

@tkuldeep
Created January 13, 2016 06:02
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 tkuldeep/75554b997242b76e69a2 to your computer and use it in GitHub Desktop.
Save tkuldeep/75554b997242b76e69a2 to your computer and use it in GitHub Desktop.
Get Date pattern by country code
require_once DRUPAL_ROOT . '/includes/locale.inc';
$countries = country_get_list();
foreach ($countries as $code => $name) {
$new_countries[$code]['name'] = $name;
$fmt = new IntlDateFormatter(
$code,
IntlDateFormatter::SHORT,
IntlDateFormatter::SHORT
);
$pattern = $fmt->getPattern();
$new_countries[$code]['pattern'] = $pattern;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment