date_format_locale
- 5 – 6
date_format_locale($langcode = NULL, $type = NULL, $reset = FALSE)
Get the appropriate date format for a type and locale.
Parameters
$langcode
Language code for the current locale. This can be a 2 character language
code like 'en', 'fr', or a longer 5 character code like 'en-gb'.
$type
Date format type: short, medium, long, custom.
$reset
Whether or not to reset this function's internal cache (defaults to FALSE).
Return value
The format string, or NULL if no matching format found.
Code
contributions/date/date_api.module, line 2087
<?php
function date_format_locale($langcode = NULL, $type = NULL, $reset = FALSE) {
static $formats;
if ($reset || empty($formats)) {
$formats = array();
$result = db_query("SELECT format, type, language FROM {date_format_locale}");
while ($object = db_fetch_object($result)) {
if (!isset($formats[$object->language])) {
$formats[$object->language] = array();
}
$formats[$object->language][$object->type] = $object->format;
}
}
if ($type && $langcode && !empty($formats[$langcode][$type])) {
return $formats[$langcode][$type];
}
elseif ($langcode && !empty($formats[$langcode])) {
return $formats[$langcode];
}
return FALSE;
}
?>