How can I know the relation between the city and its time zone in NodaTime?

眉间皱痕 提交于 2019-12-08 02:56:27

问题


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]



来源:https://stackoverflow.com/questions/21583725/how-can-i-know-the-relation-between-the-city-and-its-time-zone-in-nodatime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!