Correct the date in Russian in php
-
Here's a piece of the website. http://joxi.ru/RmzbkeoFWgML3m We need to replace the name of the month in English with the full name of the month with a small letter in Russian. How do you do that? Here's a piece of the code:
<span class="entry-time"> <?php $expire_date=strtotime(get_post_meta($post->ID,'expire_date',true));
if($expire_date): if($interval>-86400&&$interval<0): echo "Срок истекает: "."<span class=\"expired-color\">".date('M d, Y',strtotime(get_post_meta($post->ID,'expire_date',true)))."</span>"; else: echo "Срок истекает: ".date('M d, Y',strtotime(get_post_meta($post->ID,'expire_date',true))).''; endif; else: echo "Срок истекает: unknown"; endif; ?> </span><!-- .entry-time -->
-
Function http://php.net/manual/ru/function.date.php Accepts the parameter
format
valuen
♪ Where?n
It's a serial number of the month without a lead zero of 1 to 12.$arr = [ 'январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь' ];
// Поскольку от 1 до 12, а в массиве, как мы знаем, отсчет идет от нуля (0 до 11),
// то вычитаем 1 чтоб правильно выбрать уже из нашего массива.$month = date('n')-1;
echo $arr[$month].' '.date('d, Y');