Answers for "laravel 8 blade get days and hours ago"

PHP
0

laravel 8 blade get days and hours ago

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

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

@if($diffInDays > 0)

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

@endif

{{$showDiff}}
Posted by: Guest on August-08-2021

Browse Popular Code Answers by Language