1

Is there a way to get the time zone information given the name of a country, a state and a city?

For e.g. if I have the string United States, Illinois and Chicago, is there a way to get an object like the TimeZoneInfo that gives me information such as the UTC offset for that time zone, its standard name (Central Standard Time), its display name, whether or not the time zone supports daylight saving, etc.

I am using the .NET framework v4.6.1.

Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336
  • Obviously there is no such API in .net framework ... and asking for lib/online API is off-topic for SO. – Selvin Feb 16 '19 at 09:53
  • Since this information is published in a database by the IANA, and all popular operating systems periodically sync with that database, I was wondering if there was already something someone had written to do a reverse look up on a zone tab file and give me this information. Failing that, I will write one myself since I have downloaded that database. – Water Cooler v2 Feb 16 '19 at 09:57
  • 1
    Although you'll find *some* cities in IANA, there will be an awful lot that aren't there - and the IDs are meant to be "mostly opaque" anyway. You probably want a geocoding service to get back an IANA time zone ID, and then you can use something like my [Noda Time project](https://nodatime.org) to go from there. – Jon Skeet Feb 16 '19 at 10:06
  • Thanks, @JonSkeet. That's the route it looks like I'll be taking for now. – Water Cooler v2 Feb 16 '19 at 10:21
  • Have a look at this: https://stackoverflow.com/questions/41504/timezone-lookup-from-latitude-longitude – user1845593 Feb 16 '19 at 12:25

0 Answers0