2

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.

Michael Stum
  • 177,530
  • 117
  • 400
  • 535

4 Answers4

3

The OpenNetCF library supports TimeZones.

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

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
0

How about TimeZones with C# on Windows Mobile

Gregor
  • 1,691
  • 1
  • 20
  • 22
0

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

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

GeekyMonkey
  • 12,478
  • 6
  • 33
  • 39
0

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
  • 18,714
  • 13
  • 76
  • 95