Find UTC Offset given a city

这一生的挚爱 提交于 2019-12-08 02:25:34

问题


In C++ on Windows, given a city, lets say london or newyork or sydney or singapore etc.. how do I find the UTC offset for each of them, ie the function should be able to accept a city name and return the UTC offset in the current scenario ie taking into account daylight savings. Any ideas how this can be done using win32 APIs


回答1:


Sounds like you want an API for searching the zoneinfo / tz database..?

Don't know if there is a library with precisely the interface you want. But reading it and searching it yourself would not be difficult. It's just a flat file database, text with one record per line.

http://en.wikipedia.org/wiki/Zone.tab



来源:https://stackoverflow.com/questions/3002910/find-utc-offset-given-a-city

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