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>")
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>")