I suspect this is going to be quite hard - I don't know of any service which converts latitude and longitude into a time zone name.
- Knowing the standard offset and DST offset doesn't help, as you won't know when they apply.
- Knowing just the country (or even country and language) doesn't help, as you won't know the region.
- Even with the exact position, you'd have to have a pretty accurate service to map every possible point on earth to the correct time zone
You might be best off using some heuristics to guess which set of time zones are possible, and then ask the user which one it actually is. Currently your best bet is probably to use TimeZoneInfo
: when Noda Time is ready for production use, that would be a better bet. (I hope - it's my project.)
Once you've got a TimeZoneInfo
(or the Noda Time ITimeZone
) the rest is relatively easy using DateTime
or DateTimeOffset
(or ZonedDateTime
in Noda). It's getting the time zone correctly to start with which is tricky.
EDIT: I've just found this SO question which suggests that Geonames may be your friend. I wouldn't be surprised if that supplied you with an Olson time zone name though - so you'll either have to use a converter to work out the Windows time zone ID, or something similar. (Let me know if you're interested in using a pre-release of Noda; this bit of it is pretty stable AFAIK.)
Note that your question cannot be answered with certainty due to political changes. Sometimes governments will make changes to time zones with very little warning. A couple of years ago, Argentina gave 11 days notice that they weren't going to observe DST, for example. Also, political boundaries can move over time. Basically you've got to hope that doesn't happen.