views:

601

answers:

4

I'd like to have a World Clock on my PocketPC. Getting the Local Time is no problem, and getting the UTC Time is even less a Problem. But I seem unable to get a specific Time Zone? Say I want the current Time Zone for New York, not knowing if it's Daylight Saving Time or not (so I do not know if it's Eastern Time (GMT-5) or Eastern Daylight (GMT-4)).

Sadly, TimeZoneInfo does not seem to exist in Compact Framework, so I wonder if there is really no other way than manually hardcoding the Daylight Saving Time changes for the desired time zones for the next 10 years in order to get a proper conversion...

Edit: TimeZone exists, but is an abstract Class that I'd have to implement myself, which I'd like to avoid because it's error prone and requires some magic on the DST Turnaround dates.

+3  A: 

The OpenNetCF library supports TimeZones.

EDIT: Compact Framework supports TimeZone, but as Michael pointed out that's an abstract class!

Mitch Wheat
Sadly No, because TimeZone is an abstract class that requires me to override it and code my logic manually, which is what I'd like to avoid if the Framework already supports it.
Michael Stum
Will look at OpenNetCF as well.
Michael Stum
+1  A: 

How about TimeZones with C# on Windows Mobile

Gregor
The page disappeared (the whole blog contents actually) :-(
Serge - appTranslator
A: 

How about using a web service to download up-to-date timezone information?

http://www.twinsun.com/tz/tz-link.htm

GeekyMonkey
No Internet on Device :(
Michael Stum
A: 

Take a look at http://www.michaelbrumm.com/simpletimezone.html. There's also a way to fetch the time zones information from the registry (not just your local time zone), see http://msdn.microsoft.com/en-us/library/ms725481(VS.85).aspx

UPDATE: maybe this could help: http://social.msdn.microsoft.com/forums/en-US/windowsgeneraldevelopmentissues/thread/feed3c46-18ea-4d5a-b5cf-7d85823fae01/

I'm not sure if a compact device has the same information, but you could extract the time zones from a PC and then store them in a structure or a file on a compact device. But you would then probably have to update it once in a while, since these things tend to change.

Igor Brejc