Show Times around World

  • Thread starter franklinbukoski
  • Start date
F

franklinbukoski

I'd like to show multiple times in the database but can not figure out how to
do this.

I've tried =(Time()+8)
Looked through the help menu and searched this discussion group without
success.
 
M

Mr B

franklinbukoski,

If you add the line below as the control source for a text box on your form,
it will produce the current time at your location (based on the current date
and time in your computer).

=Format(Now(),"h:n AM/PM")

If you add the line below as the control source for a text box on your form,
it will produce the current time where the time is one hour ahead of your
location:

=Format(DateAdd("h",1,Now()),"h:n AM/PM")

If you add the line below as the control source for a text box on your form,
it will produce the current time where the time is two hours behind you:

=Format(DateAdd("h",-2,Now()),"h:n AM/PM")

Take a look in the help file for more information on using the "DateAdd"
function.
 
A

Al Campagna

franklin,
You might also want to know what Date it is, as well as time.
Given that Now() is the current Date&Time... and you're in New York.
Chicago Time = DateAdd("h", -1,Now())
Los Angeles = DateAdd("h", -3, Now())
If you dont want the date, just format the calculation result for Time.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
F

franklinbukoski

Thank both of you very much!

Al Campagna said:
franklin,
You might also want to know what Date it is, as well as time.
Given that Now() is the current Date&Time... and you're in New York.
Chicago Time = DateAdd("h", -1,Now())
Los Angeles = DateAdd("h", -3, Now())
If you dont want the date, just format the calculation result for Time.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
F

franklinbukoski

I've got all of the times working. I thought it would automatically be a
running clock but the times are stagnant, from when I first opened the form.

I have 6 different world times I'd like to show on the startup page. This
page remains open while users navigate to different pages and return to the
startup periodically.

Is there a way to get all of the clocks to run simultaneously, realtime?
 
F

franklinbukoski

As I continue to work on this, I think all I need to do to get it working is
to figure out how to manipulate the following:
= Format(Now, "hh:nn")
to add and subtract hours.
 
M

Mr B

As Doug as indicated, if you want the times to be continually updated then
you would need to put code in the timer event of the form that would cause
each of your times to be updated at a specific interval.

In the examples that I provided for displaying the various times, each time
is independent and not dependent on the other time.

You really should take a look at the code example that Doug provided for use
in the timer event of your form. This will work to keep all times continually
update.
 
D

Douglas J. Steele

You add and subtract the hours, then format. The Format function converts
whatever's passed to it to Text, so you cannot do arithmetic with it.

Format(DateAdd("h", -1, Now()), "hh\:nn")
 
F

franklinbukoski

The article was very beneficial. I input the following with one last problem:
Private Sub Form_Timer()
Me!Eastern.Caption = Format(Now, "dd mmm / hh:nn")
Me!Central.Caption = Format(DateAdd("h", -1, Now()), "dd mmm / hh:nn")
Me!Pacific.Caption = Format(DateAdd("h", -3, Now()), "dd mmm / hh:nn")
Me!Berlin.Caption = Format(DateAdd("h", 6, Now()), "dd mmm / hh:nn")
Me!Tokyo.Caption = Format(DateAdd("h", 14, Now()), "dd mmm / hh:nn")
Me!Baghdad.Caption = Format(DateAdd("h", 8, Now()), "dd mmm / hh:nn")
Me!Afghanistan.Caption = Format(DateAdd("h", 9.5, Now()), "dd mmm /
hh:nn")
End Sub

The problem being the code does not recognize 9.5, or 9 1/2, or 9:30. Where
time in Kabul, Afghanistan is 9.5 hours ahead of my time (eastern standard
time, US)
 
M

Mr B

Your on your own with the half hour thing. I did not know that there was any
situation where there was a half hour difference in time. I thought all time
zones were in one hour imcrements.

I'll be interested in the out come. Please post back with the answer.

Mr B
 
D

Douglas J. Steele

Add 570 minutes:

Me!Afghanistan.Caption = Format(DateAdd("n", 570, Now()), "dd mmm / hh:nn")
 
F

franklinbukoski

Mr. B.

To get the correct time, I changed adding an increment of hours to minutes.

Me!Afghanistan.Caption = Format(DateAdd("n", 570, Now()), "dd mmm / hh:nn")

I wouldn't have been able to deduct this without all of the wonderful
support of this ddiscussion group!
 
F

franklinbukoski

Yes sir! In fiddling with the code I came to the same conclusion. Thank you
very much for posting to my question!
 
Top