Outlook Time Picker

S

scott

I'm trying to create a drop-down that populates choices with time increments
from 1:00 AM to 12:00 AM, just like Outlook displays. Below code does loop,
but I can not seem to get my hours to increment right or get AM and PM
correct. Any better way to accomplish this?

vLookupCalendarTimes= ""

Dim m,h,iHour,i
h=1
iHour = 1
r=1

For m = 1 to 48

r = m Mod 2

If m < 25 Then
sTimeAMPM = " AM"
Else
sTimeAMPM = " PM"
End If

If m = 1 Then
vLookupCalendarTimes = iHour & ":00:00" & sTimeAMPM
Else
Select Case r
Case r <> 0
vLookupCalendarTimes = vLookupCalendarTimes & "|" & "M" & m
& " - " & iHour & ":00:00" & sTimeAMPM
Case Else
vLookupCalendarTimes = vLookupCalendarTimes & "|" & "M" & m
& " - " & iHour & ":30:00" & sTimeAMPM
End Select
End If

m = m + 1
iHour = iHour + 1

Next

count = 0

xLookupCalendarTimes = Split(vLookupCalendarTimes, "|")

Response.Write "<select name=""StartTime"">"
Response.Write "<option selected>--Select Time--"

For Each x In xLookupCalendarTimes

Response.Write("<OPTION class=""FormTextBox"" value=""" &
xLookupCalendarTimes(count) & """>" & xLookupCalendarTimes(count) &
"</OPTION>")

count = count + 1
Next

Response.Write("</select>")
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top