Reputation: 6622
I'm using laravel 5.5 and Carbon DateTime Library and have a future date and want to display difference between that time and Now.
But note that I want to display differences as this format :
x day , y hours , z minutes
that shows how many days, hours and minutes is left to that future date
Upvotes: 1
Views: 809
Reputation:
You can read the documentation here regarding everything with difference between dates:
Upvotes: 1
Reputation: 163968
Use the diff()
method and d
, h
and i
properties like this:
$diff = $date->diff(now());
{{ $diff->d . ' days, ' . $diff->h . ' hours, ' . $diff->i . ' minutes' }}
http://carbon.nesbot.com/docs/
Upvotes: 2