How can I know the relation between the city and i

2019-05-23 17:26发布

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条回答
Deceive 欺骗
2楼-- · 2019-05-23 18:30

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]

查看更多
登录 后发表回答