473,507 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Race Time Part II

Today’s question involves two time text boxes each set to a different time
zone. Initially txtCurrentTime will be set to Pacific Time or system time.
This will change with system time as we travel across the country.
txtRaceTime will always be set to Central Time regardless of where we are in
the US.

At first I tried ‘Now() – “xx:xx:xx” but that produced an error. Anyway as
we approach the east coast the ‘minus’ would need to be a ‘plus’.

Ideally the solution would simply put the current computer time, regardless
of location, in the first text box and automatically put Central Time in the
second.

Any simple solutions? Thank you
B.
Nov 13 '05 #1
6 2831
"Rebecca Smith" <rp*****@pcez.com> wrote in
news:10*************@corp.supernews.com:
Today’s question involves two time text boxes each set to a different
time zone. Initially txtCurrentTime will be set to Pacific Time or
system time. This will change with system time as we travel across the
country. txtRaceTime will always be set to Central Time regardless of
where we are in the US.


It's 21:25 (9:25 pm). Do you know where you computer is tonight?
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 13 '05 #2
"Lyle Fairfield" wrote
It's 21:25 (9:25 pm). Do you know where
you computer is tonight?


Good one, Lyle.

Nov 13 '05 #3
Hi Rebecca,

I'm assuming that your PC is set to Central Time.
If not, I'm sure that you'll be able to correct the pattern in the code
below.

Try this:

A form containing 2 textboxes:
txtCentral Time -- Control Source: =Now() -- Format: LongTime
txtLocalTime -- Control Source: Unbound -- Format: LongTime

Now add an option group ("optTimeZone") containing the 7 time zones, and add
the code below to the form's On Timer event (Interval = 1000 ms)
Selecting a time zone from the option group will display the correct time
for that region in txtLocalTime.
********************************
Private Sub Form_Timer()

Select Case optTimeZone

Case 1 'Alaska
Me.txtLocalTime = DateAdd("h", -3, Now())
Case 2 'Pacific
Me.txtLocalTime = DateAdd("h", -2, Now())
Case 3 'Mountain
Me.txtLocalTime = DateAdd("h", -1, Now())
Case 4 'Central
Me.txtLocalTime = Now()
Case 5 'Eastern
Me.txtLocalTime = DateAdd("h", 1, Now())
Case 6 'Atlantic
Me.txtLocalTime = DateAdd("h", 2, Now())
Case 7 'Newfoundland

'Newfies are 2.5 hr later than Central, and DateAdd wont work with
fractions
Me.txtLocalTime = DateAdd("n", 150, Now())

End Select

Me.Recalc

End Sub
********************************
--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"Rebecca Smith" <rp*****@pcez.com> wrote in message
news:10*************@corp.supernews.com...
Today's question involves two time text boxes each set to a different time
zone. Initially txtCurrentTime will be set to Pacific Time or system time.
This will change with system time as we travel across the country.
txtRaceTime will always be set to Central Time regardless of where we are in the US.

At first I tried 'Now() - "xx:xx:xx" but that produced an error. Anyway as
we approach the east coast the 'minus' would need to be a 'plus'.

Ideally the solution would simply put the current computer time, regardless of location, in the first text box and automatically put Central Time in the second.

Any simple solutions? Thank you
B.

Nov 13 '05 #4
Sorry...

I no sooner hit "send" and realized "Naw waitasec.... that's not gonna work
all the time... crap!"

In the summer months, Mountain and Central time are the same!
You'll have to factor the current date into the equation and adjust it
somewhere...

"Don Leverton" <le****************@telusplanet.net> wrote in message
news:Guwuc.10567$ig5.4715@edtnps89...
Hi Rebecca,

I'm assuming that your PC is set to Central Time.
If not, I'm sure that you'll be able to correct the pattern in the code
below.

Try this:

A form containing 2 textboxes:
txtCentral Time -- Control Source: =Now() -- Format: LongTime
txtLocalTime -- Control Source: Unbound -- Format: LongTime

Now add an option group ("optTimeZone") containing the 7 time zones, and add the code below to the form's On Timer event (Interval = 1000 ms)
Selecting a time zone from the option group will display the correct time
for that region in txtLocalTime.
********************************
Private Sub Form_Timer()

Select Case optTimeZone

Case 1 'Alaska
Me.txtLocalTime = DateAdd("h", -3, Now())
Case 2 'Pacific
Me.txtLocalTime = DateAdd("h", -2, Now())
Case 3 'Mountain
Me.txtLocalTime = DateAdd("h", -1, Now())
Case 4 'Central
Me.txtLocalTime = Now()
Case 5 'Eastern
Me.txtLocalTime = DateAdd("h", 1, Now())
Case 6 'Atlantic
Me.txtLocalTime = DateAdd("h", 2, Now())
Case 7 'Newfoundland

'Newfies are 2.5 hr later than Central, and DateAdd wont work with
fractions
Me.txtLocalTime = DateAdd("n", 150, Now())

End Select

Me.Recalc

End Sub
********************************
--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"Rebecca Smith" <rp*****@pcez.com> wrote in message
news:10*************@corp.supernews.com...
Today's question involves two time text boxes each set to a different time zone. Initially txtCurrentTime will be set to Pacific Time or system time. This will change with system time as we travel across the country.
txtRaceTime will always be set to Central Time regardless of where we are
in
the US.

At first I tried 'Now() - "xx:xx:xx" but that produced an error. Anyway

as we approach the east coast the 'minus' would need to be a 'plus'.

Ideally the solution would simply put the current computer time,

regardless
of location, in the first text box and automatically put Central Time in

the
second.

Any simple solutions? Thank you
B.


Nov 13 '05 #5
Hi Chuck,
Thanks for that, but knowing how to implement API calls is still quite a bit
over my head. :(

I was just looking at the Access Web, and found a downloadable MDB file
created by Pedro Gil. http://www.mvps.org/access/forms/frm0051.htm
I think that may be just what Rebecca might be looking for. She probably
doesn't need as many time zones as are available in the combo-box, so I
modified Pedro's function so that it displays only the zones that she'll
likely be interested in.

************************************************** *****************
'Utilities for the Form
Private Function EnumRegKeys(ByVal hKey As Long) As String
'Fill the Combo Box with the TimeZone Descriptions
Dim strSubKey As String
Dim lngSubKeyCount As Long
Dim lngSubKeyMaxLen As Long
Dim lngSubKeyLen As Long
Dim lngRet As Long
Dim intCount As Integer
Dim strTemp As String
'Begin Modification by Don ----------------------------------
' This is the original list of time zones:
'*************************************************
' Afghanistan Standard Time;Alaskan Standard Time;
' Arab Standard Time;Arabian Standard Time;Arabic Standard Time;
' Atlantic Standard Time;AUS Central Standard Time;
' AUS Eastern Standard Time;Azores Standard Time;
' Canada Central Standard Time;Cape Verde Standard Time;
' Caucasus Standard Time;Cen. Australia Standard Time;
' Central America Standard Time;Central Asia Standard Time;
' Central Europe Standard Time;Central European Standard Time;
' Central Pacific Standard Time;Central Standard Time;
' China Standard Time;Dateline Standard Time;E. Africa Standard Time;
' E. Australia Standard Time;E. Europe Standard Time;
' E. South America Standard Time;Eastern Standard Time;Egypt Standard Time;
' Ekaterinburg Standard Time;Fiji Standard Time;FLE Standard Time;
' GMT Standard Time;Greenland Standard Time;Greenwich Standard Time;
' GTB Standard Time;Hawaiian Standard Time;India Standard Time;
' Iran Standard Time;Israel Standard Time;Korea Standard Time;
' Mexico Standard Time;Mexico Standard Time 2;Mid-Atlantic Standard Time;
' Mountain Standard Time;Myanmar Standard Time;N. Central Asia Standard
Time;
' Nepal Standard Time;New Zealand Standard Time;Newfoundland Standard Time;
' North Asia East Standard Time;North Asia Standard Time;Pacific SA Standard
Time;
' Pacific Standard Time;Romance Standard Time;Russian Standard Time;
' SA Eastern Standard Time;SA Pacific Standard Time;SA Western Standard
Time;
' Samoa Standard Time;SE Asia Standard Time;Singapore Standard Time;
' South Africa Standard Time;Sri Lanka Standard Time;Taipei Standard Time;
' Tasmania Standard Time;Tokyo Standard Time;Tonga Standard Time;
' US Eastern Standard Time;US Mountain Standard Time;Vladivostok Standard
Time;
' W. Australia Standard Time;W. Central Africa Standard Time;W. Europe
Standard Time;
' West Asia Standard Time;West Pacific Standard Time;Yakutsk Standard Time
'*************************************************
Dim MyZones As String
MyZones = "Alaskan Standard Time;Atlantic Standard Time;Canada Central
Standard Time;Central Standard Time;"
MyZones = MyZones & "Eastern Standard Time;Mountain Standard
Time;Newfoundland Standard Time;"
MyZones = MyZones & "Pacific Standard Time;US Eastern Standard Time;US
Mountain Standard Time;"

lngRet = apiRegQueryInfoKey(hKey, vbNullString, 0&, 0&, lngSubKeyCount, _
lngSubKeyMaxLen, 0&, 0&, 0&, 0&, 0&, 0&)
For intCount = 0 To lngSubKeyCount - 1
strSubKey = Space$(lngSubKeyMaxLen)
lngSubKeyLen = Len(strSubKey) + 1
lngRet = apiRegEnumKeyEx(hKey, intCount, strSubKey, lngSubKeyLen, _
0&, vbNullString, 0&, 0&)

If InStr(1, MyZones, Left(strSubKey, lngSubKeyLen), vbTextCompare) > 0 Then

strTemp = strTemp & Left(strSubKey, lngSubKeyLen) & ";"
End If
'Debug.Print strTemp
'End Modification by Don ----------------------------------

Next 'intCount
EnumRegKeys = Left(strTemp, Len(strTemp) - 1)
End Function
************************************************** *****************

"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:c0********************************@4ax.com...

Hey, Don... The GetTimeZoneInformation API call will get all that
information for you.

<previous posts snipped> DL

--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================
Nov 13 '05 #6
Don,
Thanks!!
What you wrote - worked without a hitch, was simple for me to follow and
easily showed I can spend even more time on this simple form. :-) Now, as we
travel across the country I can just use a modification of the code you sent
to have a text box showing local time and race time - without having to
reset system time or computer time zone.
B.

Try this:

A form containing 2 textboxes:
txtCentral Time -- Control Source: =Now() -- Format: LongTime
txtLocalTime -- Control Source: Unbound -- Format: LongTime

Now add an option group ("optTimeZone") containing the 7 time zones, and add the code below to the form's On Timer event (Interval = 1000 ms)
Selecting a time zone from the option group will display the correct time
for that region in txtLocalTime.
********************************
Private Sub Form_Timer()

Select Case optTimeZone

Case 2 'Pacific
Me.txtLocalTime = DateAdd("h", -2, Now())
Case 3 'Mountain
Me.txtLocalTime = DateAdd("h", -1, Now())
Case 4 'Central
Me.txtLocalTime = Now()
Case 5 'Eastern
Me.txtLocalTime = DateAdd("h", 1, Now())
End Select

Me.Recalc

End Sub

Nov 13 '05 #7

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

Similar topics

2
2602
by: Rob | last post by:
Why is this not returning the right day or month? It gives me 5 when the rightnow variable gives a 18. import java.util.Calendar; public class Test { public static void main(String args) {...
9
1882
by: MGRIDEOUT | last post by:
Hello , I have a sub that gets all records in a table. Then displays the times in a drop-down list (ddlStartTime). My problem is that the ddl contain the date AND time. i.e. 9:00 AM in the...
2
2494
by: Noozer | last post by:
I have a textbox on one of my forms that is used to accept a time from the user. I need to write this value to a database to trigger an event later on. What I'd like to know is... Are there...
1
11800
by: aaa | last post by:
Hi I am trying to bind Text property of label control to datetime object (attribute from typed dataset). The problem is that I want only to show date part. Currently I use following code: ...
5
2640
by: ad | last post by:
I have a tabls of SQL 2000, about the data of student. The data is migrate from another databse, There is a field called birthday, it stores the data with the formate like: 1994/11/03 AM 02:09:00...
3
1995
by: Jim in Arizona | last post by:
I have a simple query that queries an access database. One of the fields is date/time. I use this to extract the date from the field in access: CDate(objDataReader("date")).ToString When the...
2
6072
by: john | last post by:
From an Excel-import I have an access table with a datetime field of wich both date and time are entered. I've set the field's notation properties to Short Date. When I view the table in tableview...
0
1021
by: ANR22 | last post by:
Dear All, I have little query for the time part. I written following script want to fetch time. declare @pack1_in_time datetime select @pack1_in_time = CONVERT(CHAR(5),convert(datetime,...
1
7030
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
7482
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
5623
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,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.