Country with current time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I want to make a form in which i put country name, I want to know what i do
for detect the country's current time.
 
Not sure that's possible: many countries have more than one time zone in
them.
 
Hi,

I want to make a form in which i put country name, I want to know what i do
for detect the country's current time.

As Douglas says, this is not possible in practice; the United States
has six timezones, I believe Russia has eight.

That said... if you can use finer geographic resolution or can accept
an answer "That depends on the timezone", you could create a table
with one entry for each country (I'd use the United Nations country
codes), with a number field indicating the offset from Universal Time.
It would be a fairly simple expression using DateAdd() to get from
your own system clock time, to Universal Time, to the time for the
selected location. I don't know where one would easily find the data
to fill this table but I'm sure it's out there somewhere!


John W. Vinson[MVP]
 
It might make more sense to introduce another couple of tables in there for
time zone. (It's a many-to-many between time zone and country,
unfortunately).

Once you know the time zone, the offset to UTC is actually in the registry
(in HKLM\Software\Microsoft\Windows NT\CurrentVersion\TimeZones)

Randy Birch has several examples of how to deal with time zone information
at http://vbnet.mvps.org/code/locale/index.html (Obligatory Warning: Randy's
site is aimed at VB programmers. Since there are signficant differences
between the controls available for forms in VB and in Access, some of his
examples will not port into Access without some tinkering)

Another possibility that just occurred to me is to download the sample
database Pedro Gil provided to "The Access Web". You can find it at
http://www.mvps.org/access/forms/frm0051.htm

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)
 
Back
Top