M
M
Minusator2018-10-03 19:41:12
PHP
Minusator, 2018-10-03 19:41:12

How to change English months to Russian?

Good afternoon!
Tell me how to display the months in Russian in my case?

<?php
$datePosted = $val["time"];
$lpOnlyDate = date('j F Y в', strtotime($datePosted));
?>

Functions.php
function lp_get_all_months(){
      $months = array(1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля', 5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа', 9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря');
      return $months;
    }

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pushkarev, 2018-10-03
@Minusator

WP has a built in feature

function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false )

$lpOnlyDate = date_i18n('j F Y в', strtotime($val["time"]));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question