Last active
April 11, 2017 09:18
-
-
Save eonarik/fc93a1db27ace030f6aa2bd9c6e14d41 to your computer and use it in GitHub Desktop.
modx snippet dateRU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // v1.0.2 | |
$date = date($options,!empty($input) ? $input : time()); | |
$months_arr = array( | |
'January' => array('Январь', 'января'), | |
'February' => array('Февраль', 'февраля'), | |
'March' => array('Март', 'марта'), | |
'April' => array('Апрель', 'апреля'), | |
'May' => array('Май', 'мая'), | |
'June' => array('Июнь', 'июня'), | |
'July' => array('Июль', 'июля'), | |
'August' => array('Август', 'августа'), | |
'September' => array('Сентябрь', 'сентября'), | |
'October' => array('Октябрь', 'октября'), | |
'November' => array('Ноябрь', 'ноября'), | |
'December' => array('Декабрь', 'декабря'), | |
'Jan' => array('Янв', 'янв'), | |
'Feb' => array('Фев', 'фев'), | |
'Mar' => array('Мар', 'мар'), | |
'Apr' => array('Апр', 'апр'), | |
'May' => array('Май', 'май'), | |
'Jun' => array('Июн', 'июн'), | |
'Jul' => array('Июл', 'июл'), | |
'Aug' => array('Авг', 'авг'), | |
'Sep' => array('Сен', 'сен'), | |
'Oct' => array('Окт', 'окт'), | |
'Nov' => array('Ноя', 'ноя'), | |
'Dec' => array('Дек', 'дек'), | |
); | |
foreach($months_arr as $key => $month){ | |
if(strpos($date,$key) !== false){ | |
if(is_array($month)){ | |
if(strpos($date,$key) === 0){ | |
$month = $month[0]; | |
} else { | |
$month = $month[1]; | |
} | |
} | |
$date = str_replace($key,$month,$date); | |
break; | |
} | |
} | |
return $date; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment