Skip to content

Instantly share code, notes, and snippets.

@sartas
Created December 23, 2013 10:05
Show Gist options
  • Select an option

  • Save sartas/8094453 to your computer and use it in GitHub Desktop.

Select an option

Save sartas/8094453 to your computer and use it in GitHub Desktop.
function news_date($time)
{
$date = new DateTime($time);
$out = array();
$out[] = $date->format('d');
$out[] = rus_month($date->format('m'), 1, 1);
$out[] = $date->format('Y');
return implode(' ', $out);
}
function rus_month($n, $lower = false, $padezh = false)
{
$n = $n - 1;
$months = array(
"Январь",
"Февраль",
"Март",
"Апрель",
"Май",
"Июнь",
"Июль",
"Август",
"Сентябрь",
"Октябрь",
"Ноябрь",
"Декабрь"
);
if ($padezh)
{
$months = array(
"Январяь",
"Февраля",
"Марта",
"Апреля",
"Мая",
"Июня",
"Июля",
"Августа",
"Сентября",
"Октября",
"Ноября",
"Декабря"
);
}
$out = ($lower) ? mb_strtolower($months[$n]) : $months[$n];
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment