Laravel Get Difference Between Two Dates in Days Example




hi guys,

In this example, I will help you to How to get difference between two dates in days using carbon in laravel. you need to get difference between two dates in count to days using carbon in can simply use to diffInDays() method in laravel.

In Following example you can see, we have a two dates, first $start_date variable and second one $end_date variable. Carbon class diffInDays function using you can get difference between two dates. I hope you will find your solution.

Example 1 :


* Show the application dashboard.


* @return \Illuminate\Contracts\Support\Renderable


public function index(Request $request)


$start_date = \Carbon\Carbon::createFromFormat('d-m-Y', '1-5-2015');

$end_date = \Carbon\Carbon::createFromFormat('d-m-Y', '10-5-2015');

$different_days = $start_date->diffInDays($end_date);



It will help you...


#Laravel 6