$created = new Carbon($survey->created_at);
$now = Carbon::now();
$difference = ($created->diff($now)->days < 1)
? 'today'
: $created->diffForHumans($now);
use CarbonCarbon
Carbon::parse()->parse('2022-09-20')->diffInHours(Carbon::parse()->parse('2022-09-21 10:50'));
// 34
$to = CarbonCarbon::createFromFormat('Y-m-d H:s:i', '2015-5-5 3:30:34');
$from = CarbonCarbon::createFromFormat('Y-m-d H:s:i', '2016-6-6 9:30:34');
$diff_in_months = $to->diffInMonths($from);
print_r($diff_in_months); // Output: 1
$dt = Carbon::create(2012, 1, 31, 0);
$future = Carbon::create(2012, 1, 31, 0);
$future = $future->addMonth();
echo $dt->diffInDays($future); //31
$startdate->diffInDays($todate); //total days between two dates
$startdate->diffInMinutes($todate); //total number of minutes between two dates
$startdate->diffInMonths($todate); //total number of months difference
$time = Carbon::now()->diff($row->entry_date);
return '<td>' . $time->y . ' Year' . $time->m . ' Month' . $time->d . ' Day' . '</td>';