I have this script which returns time range between 2 dates, but adding 1 day!!
$date_1 = date("Y-m-d g:i:s", strtotime('2013-06-27 12:00:00'));
$date_2 = date("Y-m-d g:i:s", strtotime('2013-06-29 12:00:00'));
$results = array($date_1);
$i = $date_1;
while ($i <= $date_2) {
$i = date("Y-m-d g:i:s", strtotime("+1 day", strtotime($i)));// how do I take off here this "+1 day"
array_push($results, $i);
echo $i;
}
So when I echo
out $i
I get the following string
2013-06-28 2013-06-29 2013-06-30
while I Need
2013-06-27 2013-06-28 2013-06-29
The problem is obviously this "+1 day" but if I take it off from my function a get error.
How to solve this?