I need to find the difference between the two dates. Say i have 2017-02-01 - 2017-01-01. The number of days between the two days is the output
$formatted_d
Carbon format() function will convert to string so remove format('Y-m-d') like this:
format()
format('Y-m-d')
$formatted_dt1=Carbon::parse($a->date); $formatted_dt2=Carbon::parse($c->dt); $date_diff=$formatted_dt1->diffInDays($formatted_dt2);
Hope you understand. You can see docs here.