sd077
sd077

Reputation: 483

Calculate hours and minutes from end date and current date in laravel blade?

I want to calculate hours and minutes from end date(stored in my table) and current date in laravel blade.

My blade:

{{\Carbon\Carbon::parse($data['end_date'])->diffForHumans(null, null, null,2)}}

Upvotes: 0

Views: 215

Answers (1)

OMR
OMR

Reputation: 12208

 $end_date = \Carbon\Carbon::parse($data['end_date']);
        $start_date = \Carbon\Carbon::parse($data['start_date']);


        $value = $end_date->diff($start_date,2)->format(' %D days  %H hours - %I minutes');

for more details see:

https://www.php.net/manual/en/dateinterval.format.php

Upvotes: 1

Related Questions