Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Neeraj1005's avatar

Date format in laravel blade

how do I get a date format like this ?

Fri, 20 Dec 2019 12:52 PM

this is my blade file date tag

<td>
   {{$quote->created_at->diffForHumans()}}
       </td>

And there some laravel tips..? for date format...?

0 likes
8 replies
Nakov's avatar

@neeraj1005 no, diffForHumans() will give you time since the quote was created.. For example: 10 minutes ago similar to what you can see here on the threads.

Here is the documentation for Carbon, you can find the format there:

https://carbon.nesbot.com/docs/

Neeraj1005's avatar

@nakov

{{$quote->created_at->toIso8601String()}}

I am getting this type of output :

2019-12-30T12:35:36+00:00
Nakov's avatar
Nakov
Best Answer
Level 73

@neeraj1005 try this one:

{{$quote->created_at->format('D, d M Y h:i A') }}
1 like
Neeraj1005's avatar

@nakov This is working perfectly my output is

Mon, 30 Dec 2019 12:41 PM

Problem is: why it showing 12:41 pm while the time in my region is 6:13pm

Nakov's avatar

@neeraj1005 because that's the time when the Quote was created I guess. Or because of the Server time.

Neeraj1005's avatar

@nakov the quote is created recently, and in my database server the time is different. How can I solve this. I am using XAMPP server.

Please or to participate in this conversation.