Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel 8 blade get days and hours ago

@php($diffInDays = CarbonCarbon::parse($user->created_at)->diffInDays())

@php($showDiff = CarbonCarbon::parse($user->created_at)->diffForHumans())

@if($diffInDays > 0)

@php($showDiff .= ', '.CarbonCarbon::parse($user->created_at)->addDays($diffInDays)->diffInHours().' Hours')

@endif

{{$showDiff}}
 
PREVIOUS NEXT
Tagged: #laravel #blade #days #hours
ADD COMMENT
Topic
Name
3+5 =