VolcovMeter VolcovMeter - 3 months ago 12
PHP Question

How to display particular time format in PHP's Laravel/Lumen?

In my view, I have this code:

@foreach ($tickets as $t) {
<p> {{ $t->updated_at }} </p>
@endforeach


Which ultimately produces:

2016-08-18 01:23:45
...


Is there anyway to do something to the effect of:

{{ $note->updated_at("l, h:i A") }}


So that what shows is:
Thursday, 01:23 AM

Answer

Basically, the date/datetime properties in Eloquent are converted to Carbon object, so you can do it like this,

{{ $note->updated_at->format("l, h:i A") }}