I have created_at
field. on my database, and I need to get the month name, for example;
...
{{\Carbon\Carbon::now()->monthName}}
...
So how can I do it for $value->created_at
?
I tried some solutions but didn't get the month name.
created_at
already a Carbon instance, so you can do that by :
{{ $value->created_at->format('F') }}
Or,
{{ \Carbon\Carbon::parse($value->created_at)->format('F') }}
Translate to other language : You can use carbon to format your local language, as for Russian
language :
@php
\Carbon\Carbon::setLocale('ru');
@endphp
{{ \Carbon\Carbon::parse($value->created_at)->translatedFormat('F') }}
// output : ноябрь