Reputation: 1
$date_from = @$_REQUEST['Start'];
$date_from = strtotime($date_from); // Convert date to a UNIX timestamp
$date_to = @$_REQUEST['Finish'];
$date_to = strtotime($date_to);
$day = 86400;
for ($i=$date_from; $i<=$date_to; $i+=86400)
{
echo date("Y-m-d",$i);
}
I encounter some problem with this code. Basically this code run well, but when you fill value $date_from = '2016-10-28' AND value $date_to = '2016-11-03', The Result appear in my screen :
2016-10-28
2016-10-29
2016-10-30
2016-10-30
2016-10-31
2016-11-01
2016-11-02
When it was supposed to be :
2016-10-28
2016-10-29
2016-10-30
2016-10-31
2016-10-01
2016-11-02
2016-11-03
Is there's error on my code or ? Because i have tried with different range but, everything went fine. Only this range of date appear like this.
Need Help.
Upvotes: 0
Views: 35