Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help w- DATE function... 1

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have a form that needs to offer appointment dates based on the following criteria:

Offer FIVE date options
(these are displayed in a pull-down form)
Starting Three Days from Now
Omitting Saturdays and Sundays (possibly Sundays Only)

So if page was called today- Monday, appointments would be offered Thur, Fri, Mon, Tue and Wed, including month & date.

TIA for any help here...
smiletiniest.gif
 
Do you use mysql? ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Here you go. You can change how the date displays by editing the part at the bottom. Here's a list of possible values:

<?

function get_next_days(){
$next=array();

for($i=0;$i<5;$i++){
$next[$i] = mktime (0,0,0,date(&quot;m&quot;),date(&quot;d&quot;)+$i+3,date(&quot;Y&quot;));
if(date(&quot;D&quot;,$next[$i])==&quot;Sat&quot;){
$next[$i] += 86400*2;
} elseif(date(&quot;D&quot;,$next[$i])==&quot;Sun&quot;){
$next[$i] += 86400;
}
for($j=0;$j<sizeof($next)-1;$j++){
if(date(&quot;d&quot;,$next[$j])==date(&quot;d&quot;,$next[$i])){
$next[$i]+=86400;
}
}
}
print(&quot;<select>&quot;);
for($j=0;$j<5;$j++){
/////////////////////////Edit below//
print(&quot;<option>&quot; . date(&quot;M - D - d - Y&quot;,$next[$j]) . &quot;</option>&quot;);
}
print(&quot;</select>&quot;);
}

get_next_days();

?>

Rick if(($question==&quot;has been bugging me&quot;
AND $answer==&quot;fixed the problem&quot;) OR $answer==&quot;really good post&quot;){
print(&quot;Star&quot;);
}else{
print(&quot;Thanks.&quot;);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top