Currently I'm using NodaTime to get the time zone from country but the problem is if there are multiple time zones in a country. How could I know the list of the cities in that time zone? I need to know do the mapping between these two data. Is it possible with NodaTime?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The correct way to handle this is as follows:
Find latitude and longitude for each location. If these are airports, then consider using the data from OurAirports.com. You might also be interested in OpenFlights, but be aware that they source their data from OurAirports.com anyway. And while OpenFlights data has some time zone information, it's not accurate enough to map to a true IANA time zone identifier.
Once you have longitude and latitude, then you can use one of these methods to lookup the time zone from the location.
Then you can pass that time zone identifier to NodaTime via
DateTimeZoneProviders.Tzdb[theTimeZoneId]