![]() |
Outlook Time Picker
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>") |
Re: Outlook Time Picker
I've got it going. I missed the obvious.
"scott" <sbailey@mileslumber.com> wrote in message news:e8L1G4gYFHA.3132@TK2MSFTNGP09.phx.gbl... > 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>") > |
| All times are GMT. The time now is 12:07 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.