I'd like to make a selection list of dates that a user could choose from. The date should start by the Current date today and ends 5 days after. I just don't know how to execute it inside a loop so I wouldn't change the date over and over again. Thanks. Please help. ;(
$date = new DateTime(); // Without argument: now
$interval = new Dateinterval("P1D"); // Period: 1 day
for ($i = 0; $i <= 5; $i++) {
echo $date->format("Y-m-d")."\n";
$date->add($interval);
}
I'd like to make a selection list of dates that a user could choose from. The date should start by the Current date today and ends 5 days after. I just don't know how to execute it inside a loop so I wouldn't change the date over and over again. Thanks. Please help. ;(