Last active
April 5, 2021 10:55
-
-
Save if0rest/ec971b56a9122181a31c025058240197 to your computer and use it in GitHub Desktop.
[MODx] getRusDate | snippet
This file contains hidden or 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 | |
$dateNum = $scriptProperties['date']; | |
$fullDate = $scriptProperties['full'] ? true : false; | |
if (!$fullDate) { | |
$monthNum = substr($dateNum,5,2); | |
$rusMonth = array( | |
'01' => 'Январь', | |
'02' => 'Февраль', | |
'03' => 'Март', | |
'04' => 'Апрель', | |
'05' => 'Май', | |
'06' => 'Июнь', | |
'07' => 'Июль', | |
'08' => 'Август', | |
'09' => 'Сентябрь', | |
'10' => 'Октябрь', | |
'11' => 'Ноябрь', | |
'12' =>'Декабрь' | |
); | |
$date = $rusMonth[$monthNum] ." ". substr($dateNum,0,4); | |
} | |
else | |
{ | |
$dayNum = substr($dateNum,8,2); | |
$monthNum = substr($dateNum,5,2); | |
$rusMonth = array( | |
'01' => 'января', | |
'02' => 'февраля', | |
'03' => 'марта', | |
'04' => 'апреля', | |
'05' => 'мая', | |
'06' => 'июня', | |
'07' => 'июля', | |
'08' => 'августа', | |
'09' => 'сентября', | |
'10' => 'октября', | |
'11' => 'ноября', | |
'12' => 'декабря' | |
); | |
$date = $dayNum ." ". $rusMonth[$monthNum] ." ". substr($dateNum,0,4); | |
} | |
echo $date; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment