Whenever you need to find the difference between two days a day in laravel 5 where you can easily find it using Carbon. Laravel automatically offers Carbon class. Carbon class throught can calculate the difference between two days in a day.
In the following example you can see, we have two days, first $ to variable and then the second $ from the variant. The Carbon class diffInDays use you can find the difference between two days. I hope you find your solution.
$to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', '2020-12-5 2:20:20'); $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', '2020-12-6 5:50:50'); $diff_in_days = $to->diffInDays($from); print_r($diff_in_days); // Output: 1