30 _elgg_services()->logger->info(
"Unable to generate locale representation for format: '{$format}', using non-locale version");
31 return $this->format($format);
47 if (
preg_match(
'/(?<!\\|%)[BcILrtuUVZ]/', $dateFormat)) {
54 'd' =>
'dd',
'D' =>
'EEE',
'j' =>
'd',
'l' =>
'EEEE',
'N' =>
'e',
'w' =>
'c',
'z' =>
'D',
58 'F' =>
'MMMM',
'm' =>
'MM',
'M' =>
'MMM',
'n' =>
'M',
60 'o' =>
'Y',
'Y' =>
'yyyy',
'y' =>
'yy',
62 'a' =>
'a',
'A' =>
'a',
'g' =>
'h',
'G' =>
'H',
'h' =>
'hh',
'H' =>
'HH',
'i' =>
'mm',
's' =>
'ss',
64 'e' =>
'VV',
'O' =>
'xx',
'P' =>
'xxx',
'p' =>
'XXX',
'T' =>
'zzz',
70 return strtr((
string) $dateFormat, $caracs);
84 if ($correct_format ===
false) {
88 $locale_for_language =
_elgg_services()->locale->getLocaleForLanguage($language);
91 $locale = new \IntlDateFormatter(
elgg_extract(0, $locale_for_language, $language), \IntlDateFormatter::FULL, \IntlDateFormatter::FULL);
92 $locale->setPattern($correct_format);
94 return $locale->format($this);
95 }
catch (\Throwable $t) {
formatIntl(string $format, string $language)
Try to format to a locale using the 'intl' PHP module.
dateFormatToICU(string $dateFormat)
Convert a date format to a ICU format.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
formatLocale(string $format, string $language=null)
Try to format the date using locale output.
Extension of the DateTime class to support formatting a date using the locale.
_elgg_services()
Get the global service provider.