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!

Times in VBScript 1

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
I am using VBScript within ASP code. I have a form in which a user enters a booking time this is then compared to booking times already booked in a database. What I am using the VBScript for is I am trying to if the time entered in the form is equal to a time held in the database and also if their are times in the range of the time entered by the user plus 15 minutes and less than 15 minutes. So any times that are between the time range plus 15 minutes either way then a booking cannot be made as bookings can only be made 15 minutes apart from each other.

I have tried using Between but the ASP page doesn't seem to like this any suggesions wiuld be welcome.

Thanks.
 
Do you have some code we can check? That would be very helpful. Yours,

Rob.
 
Try this...

I don't know your table names and such, but the pseudo names here should help..

'time that user selected on form
new_appt_time = request("appt_time")

'times in the database
sql = "select appt_time from appointments"
rs.open sql, db

do while not rs.eof
appt_time = rs("appt_time")
if not((appt_time + 15) > newtime > (new_appt_time - 15)) then
conflict = true
exit do
end if
loop

if conflict = true then
response.write "Scheduling conflict"
response.end
end if
 
quick correction

if not((appt_time + 15) > newtime > (appt_time - 15)) then
' not new_appt_time------------------^

The valueA > valueB > valueC is a BASIC shortcut for "between" If can be read ad "valueB is between valueC and ValueA"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top