Support the ongoing development of Laravel.io →
Eloquent Views
Last updated 2 years ago.
0

You can just use plain php

 {{ date('HH:MM', $shift->time_start) }}

or better use the presenter pattern https://github.com/laracasts/Presenter

0

I get and error. A non well formed numeric value encountered

eg. of time value = 20:00:00 {{ date('HH:MM', '20:00:00') }} produces error as well

0

This works

{{ date('G:i', strtotime($shift->time_start)) }}

At the end I create a view and converted the time field to a data time field and used this instead

{{ $shift->shift_start->format('H:i') }}
0

Apparently $shift->time_start is not a unix tims tamp which is required by date function

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.