Javascript World Timezone Difference to GMT Calculator

喜你入骨 提交于 2020-01-11 03:54:46

问题


I was hoping someone could send me in the direction of a regularily updating time zone database.

I have found one, but apologies i cant remember where it was from, however with the current GMT clock change fast approaching, i fear all my data will be incorrect, ie the differences from UK to New Yrok will change from 5 hours behind to 6 hours behind.

Any help on this matter would be much appreciated.

Cameron


回答1:


Do you mean like the Olson database ?

For instance, the fleegix.js javascript library is a timezone-enabled, drop-in replacement for the stock JavaScript Date, giving you full-blown timezone support, independent from the timezone set on the end-user's machine running the browser. It uses the Olson zoneinfo files for its timezone data.

I believe the time-converter uses also such a database, as well as timeanddate.com, e.g. for London or New-York.


Any DST information (Daylight Saving times) can be deduced from timeanddate.com, but also from daylight-savings-time.info

Here is a javascript program that does exploit DST informations in order to apply the correct time shift.
And also another script for SimpleTimeZone.

You can also query DST data from global-time-zones.com, as in wwp.britishsummertime.co.uk. You have also informations in webexhibits.org

See this forum for a lengthy discussion about how to retrieve DST informations.

Finally, see that SO question for a tar.gz Olson database example.




回答2:


If you have the latitude and longitude of wherever it is you want the timezone information for then you can map that to live timezone info using a service such as this one: http://www.earthtools.org/webservices.htm#timezone

If you are starting with an address or place name, you can get the lat/lng information using a geocoding service - e.g. see geonames.org, or google and yahoo also have services. Then use the timezone service as above.



来源:https://stackoverflow.com/questions/233041/javascript-world-timezone-difference-to-gmt-calculator

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