php date function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

php date function

Post 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.....
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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;
Post Reply