473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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>")
Jul 22 '05 #1
1 1373
I've got it going. I missed the obvious.
"scott" <sb*****@mileslumber.com> wrote in message
news:e8**************@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>")

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: john | last post by:
Can someone give me a url of a time picker? I found a lot of date/time picker but no timepicker alone. I just want a time picker. Thanks.
5
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an...
4
by: timmy_dale12 | last post by:
I have a time field in an application. I am looking for some kind of pop up function that lets me insert a time. So its like a calendar pop up but you can choose a valid time instead of a date ...
3
by: TD | last post by:
This code doesn't work. Every posting I can find suggests that it should. If TypeOf controlname Is DTPicker then do something here End If I am using the Date Time Picker control and wish to...
2
by: Need Helps | last post by:
The example given in msdn.com on how to create a Date Time Picker involves using the CreateWindowEx function. However, I created a dialog box using the graphical interface, and then used the...
4
by: Michael Turner | last post by:
Hi Guys I have two DateTime pickers one shows the Date and the other the time, this is a requirement of the solution. The problem I have is that when the time is saved to the sql database into a...
4
by: Michel Posseth [MCP] | last post by:
I have a problem with the date time picker validate event wich i believe is a bug How to reproduce : throw on a form a date time picker control and a textbox control select the validating...
0
by: fredloh | last post by:
i have a tab control on my form. i then have several microsoft date and time picker control on the tab control. when i select a date on any of the date and time picker control, the result of the...
1
by: =?Utf-8?B?TWlrZSBAIEZyaWVkbWFuJ3M=?= | last post by:
Is there a way to disable the stationary picker in Outlook 2003, besides removing all the options or setting the compose to HTML in Mail Format? I have looked through group policy as well as try...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.