Is there any PHP function to display all dates between two dates?
See Question&Answers more detail:osIs there any PHP function to display all dates between two dates?
See Question&Answers more detail:osThere is the DatePeriod
class.
EXAMPLE:
$begin = new DateTime('2013-02-01');
$end = new DateTime('2013-02-13');
$daterange = new DatePeriod($begin, new DateInterval('P1D'), $end);
foreach($daterange as $date){
echo $date->format("Y-m-d") . "<br>";
}
(P1D stands for period of one day, see DateInterval
for further documentation)