I have a calendar application which utilizes the newer PHP DateTime classes. I have a way that I handle recurring events, but it seems hack-ish and I wanted to see if you guys h
This can be done nicely using a DatePeriod as an Iterator and then filterd to the start date you want to display:
starttime = $start->getTimestamp();
}
public function accept() {
return ($this->starttime < $this->current()->getTimestamp());
}
}
$db = new DateTime( '2009-11-16' );
$de = new DateTime( '2020-12-31 23:59:59' );
$di = DateInterval::createFromDateString( '+3 days' );
$df = new DateFilterIterator(
new DatePeriod( $db, $di, $de ),
new DateTime( '2009-12-01') );
foreach ( $df as $dt )
{
echo $dt->format( "l Y-m-d H:i:s\n" );
}
?>