use CarbonCarbon
Carbon::parse()->parse('2022-09-20')->diffInHours(Carbon::parse()->parse('2022-09-21 10:50'));
// 34
$dt = Carbon::create(2012, 1, 31, 0);
$future = Carbon::create(2012, 1, 31, 0);
$future = $future->addMonth();
echo $dt->diffInDays($future); //31
$date1->toDateString() == $date2->toDateString()