Displaying Time at 10-minute Intervals


R

Rick Barr

I'm trying to build a tee-time reservation page, and want to display
all the available tee times on one page for a particular date. I
simply want to list the times out in 10-minute intervals, like:

8:30am
8:40am
8:50am

Additionally, I want to be able to parse out the times that already
have entries in my SQL database, but for now I'll settle for just
getting the times listed.

Thanks,

-Rick
 
Ad

Advertisements

D

David Dorward

Rick said:
I'm trying to build a tee-time reservation page, and want to display
all the available tee times on one page for a particular date. I
simply want to list the times out in 10-minute intervals, like:

This is best done on the server, not with client side scripting.
Additionally, I want to be able to parse out the times that already
have entries in my SQL database, but for now I'll settle for just
getting the times listed.

This must be done on the server, so you might as well save yourself the
effort of mucking around with client side scripting only to have to start
again.
 
E

Evertjan.

Rick Barr wrote on 28 jun 2003 in comp.lang.javascript:
I'm trying to build a tee-time reservation page, and want to display
all the available tee times on one page for a particular date. I
simply want to list the times out in 10-minute intervals, like:

8:30am
8:40am
8:50am

Besides the "american" way of time being crasy,
and Noon never being am nor pm:


<table border=1>
<script>
end=false
h=8
m=3
ap="0am"
td1="<tr><td style='text-align:right;width:110px;'>"
dd=":"
td2="</td><td style='text-align:right;width:100px;'>Free</td></tr>"

while (!end){
document.write(td1+h+dd+m+ap+td2)
m++
if(m==6){
m=0
h++
if(h==12)ap="0pm"
if(h==13)h=1
}
if(ap=="0pm"&&h==9&&m==1)end=true
}
</script>
</table>
 
E

Evertjan.

David Dorward wrote on 28 jun 2003 in comp.lang.javascript:
This is best done on the server, not with client side scripting.

Also on a server it can perfectly well be done with javascript.
 
Ad

Advertisements

R

Rick Barr

Thanks VERY much for this. It makes sense, how it works, and I did go
ahead and make it a server-side script. Now I'll just need to work on
filtering out the times where a record already exists.

-Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top