Answer the question
In order to leave comments, you need to log in
How to incline month in Carbon (datetime)?
I didn't find carbon in the documentation. It is necessary to display the months in the parent case (January, February, March ...). Carbon has this, the source lists an array with:
'months' => ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'],
Carbon::parse($post->created_at)->translatedFormat('F')
//или
Carbon::parse($post->created_at)->getTranslatedMonthName()
Answer the question
In order to leave comments, you need to log in
https://carbon.nesbot.com/docs/
$now = new \Carbon\Carbon();
$now->locale('ru');
$month = $now->getTranslatedMonthName('Do MMMM');
var_dump($now->day . ' ' . $month); //string(9) "13 мая"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question