How to loop between interval of dates

In order to loop between interval of dates we use DateInterval, DatePeriod

<?php
// Your code here!
$start_date = new DateTime( '2012-02-01' );
$end_date = new DateTime( '2012-03-01' );
$end_date = $end_date->modify( '+1 day' );

$interval = new DateInterval('P1D');
$daterange = new DatePeriod($start_date, $interval ,$end_date);

foreach($daterange as $date){
    echo $date->format("Ymd") . "<br>";
}
?>


Follow our Site to Know More about Programming Tricks

ayschools.com

Thank You…