E
E
Eugene2018-06-08 10:05:00
Yii
Eugene, 2018-06-08 10:05:00

How to display the month in Russian yii2 formatter?

It costs

Yii::$app->formatter->timeZone = 'UTC';
Yii::$app->formatter->locale = 'ru-RU';

I take the date in the model and display it here
<td class="view-message  text-right"><?=Yii::$app->formatter->asDatetime($item->date, "php:d.m H:i")?></td>

In the documentation https://www.yiiframework.com/doc/guide/2.0/en/outp...
I see that it will not format values ​​of the Timestamp type into a verbal form, but only values ​​of the Date type.
But I can't use the date type because it doesn't work with the default current_timestamp, and this is done to fix the time of arrival of messages.
Is it possible to bring the date to a verbal type using the Timestamp formatter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-06-08
@evgen9586

<?=Yii::$app->formatter->asDatetime($item->date, 'long')?>

I think the problem you have is not in the timestamp, it works without problems. But if you don't have intl , it will output in English. So most likely you are not digging there. Dig into php.ini until you find:
;extension=php_intl.dll

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question