Outlook Time Picker

Discussion in 'ASP General' started by scott, May 26, 2005.

  1. scott

    scott Guest

    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>")
    scott, May 26, 2005
    #1
    1. Advertising

  2. scott

    scott Guest

    I've got it going. I missed the obvious.


    "scott" <> wrote in message
    news:...
    > 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>")
    >
    scott, May 26, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman

    Date Time Picker

    Charles A. Lackman, Nov 24, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,060
  2. Robert

    JScript time picker

    Robert, Jul 7, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    942
    Eliyahu Goldin
    Jul 7, 2003
  3. Blue Streak
    Replies:
    1
    Views:
    506
    aa7im
    Mar 21, 2005
  4. venky

    Date time picker for asp.net

    venky, Apr 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    8,012
    Juan T. Llibre
    Apr 13, 2005
Loading...

Share This Page