Ateik
Ateik

Reputation: 2586

How can I get timezone of a specific country?

How can I get the timezone of a specific city/country, I have the latitude and the longitude of the country. Can I do that with the TimeZoneInfo class?

Upvotes: 2

Views: 696

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500893

No, you can't do it with TimeZoneInfo as far as I'm aware.

The Geonames web service will give you the time zone, but it will give you the zoneinfo name rather than the Windows ID. You could use the CLDR information to provide a mapping between the two of them - that's what we do for Noda Time. (You'd embed the mapping information into your app; it's reasonably straightforward.) It looks like you can also download the Geonames data, but I expect you'd have a fair amount of work to do to use it on the device.

Of course if you'd be interested in using Noda Time directly, I'd be happy to hear about your requirements. It's not quite hit production yet, but the more use cases we have, the quicker we'll be able to design the API appropriately :)

Upvotes: 2

Related Questions