Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What time is it in New York?

And how far behind Frankfurt are they?

No, it's not as simple as it looks: if I'm lucky enough to be in New York,
or I have the admin rights to tell my machine that it's been shipped to
Manhattan, I can call the API for GetTimeZoneInformation. That'll retrieve a
time difference relative to Greenwich Mean Time and, if I'm somewhere strange
and foreign, it'll even apply the daylight saving adjustments.

But the only locale it can query is 'here', and that's usually London.
Except when people have to run my code in New York, Frankfurt or Hong Kong,
Sydney, Seoul, Tokyo and San Francisco. And they definitely don't have
administrator privileges: all they want to do is retrieve everything prior to
a locally-defined cutoff date and time.

It is possible to enumerate the registry for Time Zone keys under
HKEY_LOCAL_MACHINE
\SOFTWARE
\Microsoft
\Windows NT
\CurrentVersion
\Time Zones

But how do I read the 'TZI' subkey, a REG_BINARY, into a
TIME_ZONE_INFORMATION user-defined type in VB? And if I did, would it be any
use to me?

Anyone else come up with alternative solutions? The USA has time zones, too:
they don't move with the seasons like ours, but a lot of stateside developers
must have met this issue for data replication across state boundaries. It
can't all be hardcoded!







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default What time is it in New York?

have you looked at:
http://vbnet.mvps.org/index.html?cod...zonechange.htm


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?TmlsZV9IZWY=?=" wrote:

And how far behind Frankfurt are they?

No, it's not as simple as it looks: if I'm lucky enough to be in New
York, or I have the admin rights to tell my machine that it's been
shipped to Manhattan, I can call the API for GetTimeZoneInformation.
That'll retrieve a time difference relative to Greenwich Mean Time
and, if I'm somewhere strange and foreign, it'll even apply the
daylight saving adjustments.

But the only locale it can query is 'here', and that's usually London.
Except when people have to run my code in New York, Frankfurt or Hong
Kong, Sydney, Seoul, Tokyo and San Francisco. And they definitely
don't have administrator privileges: all they want to do is retrieve
everything prior to a locally-defined cutoff date and time.

It is possible to enumerate the registry for Time Zone keys under
HKEY_LOCAL_MACHINE
\SOFTWARE
\Microsoft
\Windows NT
\CurrentVersion
\Time Zones

But how do I read the 'TZI' subkey, a REG_BINARY, into a
TIME_ZONE_INFORMATION user-defined type in VB? And if I did, would it
be any use to me?

Anyone else come up with alternative solutions? The USA has time
zones, too: they don't move with the seasons like ours, but a lot of
stateside developers must have met this issue for data replication
across state boundaries. It can't all be hardcoded!









  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default What time is it in New York?

I hadn't seen Chip Pearson's collaboration with his fellow-MVP's on the topic
of Time Zones, and that particular use of GetTimeZoneInformation is an
interesting extension of Chip's own article at
http://www.cpearson.com/excel/timezone.htm

Nevertheless, both articles share the same limitation: the only time zone
identifier you can feed the function is 'This' time zone. I can't run a
computer in London or Hong Kong and pass the parameter 'EST' or equivalent,
expecting the function to return the TZI record with names, offsets and bias
for Eastern Standard Time.

So we're still looking at creating and populating our own hardcoded lists,
rather than extracting the information which we know is in the operating
system. Somewhere.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default What time is it in New York?

oh dear.. we have a true researcher...

the site mentioned has a few more pages on the subject...
http://vbnet.mvps.org/index.html?cod...zonechange.htm

does EXACTLY what your want. enumerating and decoding the entire hive.

the only thing you need to do is tell your notepad which timezone the
current hotelroom is...




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?TmlsZV9IZWY=?=" wrote:

I hadn't seen Chip Pearson's collaboration with his fellow-MVP's on
the topic of Time Zones, and that particular use of
GetTimeZoneInformation is an interesting extension of Chip's own
article at http://www.cpearson.com/excel/timezone.htm

Nevertheless, both articles share the same limitation: the only time
zone identifier you can feed the function is 'This' time zone. I can't
run a computer in London or Hong Kong and pass the parameter 'EST' or
equivalent, expecting the function to return the TZI record with
names, offsets and bias for Eastern Standard Time.

So we're still looking at creating and populating our own hardcoded
lists, rather than extracting the information which we know is in the
operating system. Somewhere.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default What time is it in New York?

Thanks for the extra link, decoding the hive - in particular, reading the
registry version of a TIME_ZONE_INFORMATION data structure - was the
information I needed to get the job done.

I'll post my source as soon as I have it tested, as it is probably the only
published VB code for this specific task: a nonlocal date difference function
operating across multiple time zones.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time calculations for Scheduled Time vs. Actual Time Worked The Caterer Excel Discussion (Misc queries) 1 November 29th 09 08:08 AM
straight time, time and a half, and double time Jeremy Excel Discussion (Misc queries) 3 September 23rd 08 09:03 PM
Calculate Ending time using Start Time and Elapsed Time Chief 711 Excel Worksheet Functions 5 May 13th 08 04:34 PM
verify use of TIME Function, Find Quantity Level compare to time-d nastech Excel Discussion (Misc queries) 9 July 11th 07 01:58 PM
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 02:36 PM


All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"