I've researched about on internet but what I found is only getting the past time (e.g. 4mins ago)
, What I want is to get the difference from created_at
and updated_at
in my database and like so, 3days 3hrs 23mins 30sec
and if there's no mins
or hrs
, just output the 3days 3hrs 30sec
or 3days 23mins 30sec
.
What I have:
view
@foreach($submits as $submit)
{{ $submit->pivot->created_at }} // to get the created_at
{{ $submit->pivot->updated_at }} // to get the updated_at
@endforeach