如何格式化碳日期以获得完整的月份

How to Format a Carbon Date to get the Full Month

我正在使用此代码:

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

输出为:

10 Mar 2016

我要:

10 March 2016

我查看了 Carbon 文档并在 google 上到处搜索,但我找不到任何地方。

如果我理解正确的话:

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

顺便说一下,我在 php 日期文档中找到了它,Carbon 使用它来生成日期。 https://www.php.net/manual/function.date

$date1 = '2020-03-05'; 

$date2 = Carbon::parse($date1)->format('d F y');

dd($date2);

如果您希望在日期中包含完整的月份名称,则应该这样使用:

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

format 函数中使用 f 而不是 M

  <span class="text-muted">{{$item->created_at->format('F,d,Y')}}</span>