Reputation: 1903
How do I display a range of dates from 28-10-2014
to 01-11-2014
?
28-10-2014
29-10-2014
30-10-2014
31-10-2014
01-11-2014
Upvotes: 0
Views: 143
Reputation: 1856
Try this:
<?php
$begin = new DateTime('28-10-2014');
$end = new DateTime('01-11-2014');
$daterange = new DatePeriod($begin, new DateInterval('P1D'), $end);
foreach($daterange as $date){
echo $date->format("m-d-Y");
}
?>
Upvotes: 2
Reputation: 23958
<?php
$date = "10-28-2014";
$date1 = str_replace('-', '/', $date);
$iterations = 4;
for ($i=0 ; $i<= $iterations ; $i++) {
$tomorrow = date('d-m-Y',strtotime($date1 . "+$i days"));
echo '<br/>'.$tomorrow;
}
?>
Hope this works.
Upvotes: 1