Finding days between two dates in laravel

To find days between two dates in Laravel you can do that using simple PHP. Best is to use PHP OOP way. Like this:
$fdate = $request->Fdate;
$tdate = $request->Tdate;
$datetime1 = new DateTime($fdate);
$datetime2 = new DateTime($tdate);
$interval = $datetime1->diff($datetime2);
$days = $interval->format('%a');//now do whatever you like with $days
In video, i am showing all steps in projects. Follow the steps in the video.


EmoticonEmoticon