I have the following which creates an array of dates between 'start' and 'end' dates.
use CarbonCarbon;
$from = Carbon::createFromFormat('U', $start);
$to = Carbon::createFromFormat('U', $end);
$dates = [];
for ($date = $from; $date->lte($to); $date->addDay()) {
$dates[] = $date->format('d-m-y');
}
I need to format the output of the dates to be in the format 04 October 2020. It is currently returning error 'Call to a member function format() on string' when I try and convert the date.
foreach ($dates as $date) :
echo $date;
endforeach;
I needed the date to be set initially to d-m-y format for this comparision:
foreach ($events as $event) :
if (date('d-m-y', $event->start) === $date) :
.....further processing
endif;
endforeach;
question from:
https://stackoverflow.com/questions/65850199/date-format-returning-call-to-a-member-function-format-on-string 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…