Hi, As you probably can tell from the title of the thread, the question is about formatting time.
Currently, when I retrieve time from DB, it shows as something like this: 09:45:00
The last two digits are useless in my scenario and I would like it as 09:45
My DB Query looks like this
$userDays = Day::where('user_id', '=', $user->id)
->whereMonth('date', '=', $request->month)
->whereYear('date', '=', $request->year)
->orderBy('date', 'desc')
->get();
It will select the start
and end
column from DB and my migration looks like
$table->time('start')->format('H:i');
$table->time('end');->format('H:i');
However, when look in the database (manually), it's stored as 09:45:00
.
So anything that would output the time as HH:MI would work. It can be in the migration or in the controller.
Any answers are greatly appreciated. Waleed :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community