I have two date fields Start and End
<input type="date" name="start>
<input type="date" name="end>
Now i want to get number of days between the selected range and all the dates which comes in this range.
I have two date fields Start and End
<input type="date" name="start>
<input type="date" name="end>
Now i want to get number of days between the selected range and all the dates which comes in this range.
You can use Carbon's diffInDays() method:
Carbon::parse(request('start'))->diffInDays(Carbon::parse(request('end')));
To list all the dates between these two dates:
$period = new DatePeriod(Carbon::parse(request('start')), CarbonInterval::day(), Carbon::parse(request('end')));
foreach ($period as $date) {
echo $date;
}