Page 1 of 1

php date function

Posted: Mon Jun 06, 2005 10:58 am
by itsmani1
hi there....
i want to disply 30 next dates from today => means if its 6-6-2005 today then i want to get 30 next dates form today in drop down. any help plz.

Best Regards.....

Posted: Mon Jun 06, 2005 11:04 am
by Burrito

Code: Select all

$date = array();
$nowdate = date(&quote;m/d/Y&quote;,time());
for($i=1;$i<31;$i++){
  $nowdate = date(&quote;m/d/Y&quote;, strtotime($nowdate.&quote; +1 day&quote;);
  $dateї] = $nowdate;
}

$select = &quote;<select name=\&quote;day\&quote;>&quote;;
foreach($date as $dates){
  $select .= &quote;<option value=\&quote;&quote;.$dates.&quote;\&quote;>&quote;.$dates.&quote;</option>\n&quote;;
}
$select .= &quote;</select>&quote;;
echo $select;