<?php
foreach (['en_US', 'ru_RU', 'es_ES', 'fa_IR'] as $locale) {
$dateFormat = (new \IntlDateFormatter(
$locale,
\IntlDateFormatter::SHORT,
\IntlDateFormatter::NONE
))->getPattern();
$formatWithLongYear = preg_replace(
'/(?<!y)yy(?!y)/',
'Y',
$dateFormat
);
$formatter = new \IntlDateFormatter(
$locale,
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
null,
null,
$formatWithLongYear
);
echo $formatter->format(1455111783), PHP_EOL;
}
preferences:
25.73 ms | 404 KiB | 5 Q