I have an event calendar with start and end date like this:
16.08.2010 12:00:00
- 21.08.2010 20:00:00
16.08.2010 20:00:00
- 21.08.2010 23:00:00
18.08.2010 17:00:00
- 18.08.2010 19:00:00
Whenever an event goes on for more than one day, I need to loop through each day.
I found this thread, and I thought is could help me: How to find the dates between two specified date?
I can't use the solution for PHP 5.3, because my server run PHP 5.2.
The other solutions do not procude output.
This is what I try to do:
$events = $data['events'];
foreach($ev as $e) :
$startDate = date("Y-m-d",strtotime( $e->startTime ));
$endDate = date("Y-m-d",strtotime( $e->endTime ));
for($current = $startDate; $current <= $endDate; $current += 86400) {
echo '<div>'.$current.' - '.$endDate.' - '.$e->name.'</div>';
}
endforeach;
In theory, this should loop through all days for an event that extends over several days. But that's not happening.
The logic is wrong somewhere.... please help :)