How to Format a Carbon Date to get the Full Month
Asked Answered
I

3

24

I am using this code:

Carbon\Carbon::parse($quotation[0]->created_at)->format('d M Y')

The output is:

10 Mar 2016

I want:

10 March 2016

I have looked at the Carbon docs and googled high and low, and I can not find it anywhere.

Ingesta answered 18/3, 2016 at 19:13 Comment(0)
M
65

If I understood you correctly:

Carbon\Carbon::parse($quotation[0]->created_at)->format('d F Y')

By the way, I found it in php date docs, Carbon uses it to generate date. https://www.php.net/manual/function.date

Marqueritemarques answered 21/3, 2016 at 8:25 Comment(0)
H
3
$date1 = '2020-03-05'; 

$date2 = Carbon::parse($date1)->format('F j, Y');

dd($date2);
Hypnotherapy answered 6/3, 2020 at 5:25 Comment(0)
P
0

This is how it should be used, if you wish to have the full month name in the date:

{{\Carbon\Carbon::parse($client[0]->event_date_from)->format('d F Y')}}

Use f instead of M in the format function.

Pimply answered 28/8, 2020 at 7:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.