Timezone from geolocation

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 20:37:56

问题


I have a geolocation pair latitude/longitude, is there any way/tool to get the corresponding time zone?


回答1:


A website called EarthTools has a web service for that.

http://www.earthtools.org/webservices.htm#timezone

You can pass in latitude and longitude like so:

h ttp://www.earthtools.org/timezone/40.71417/-74.00639

And it spits out the time zone and a bunch of other info:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<timezone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.earthtools.org/timezone.xsd">
    <version>1.1</version>
    <location>
        <latitude>40.71417</latitude>
        <longitude>-74.00639</longitude>
    </location>
    <offset>-5</offset>
    <suffix>R</suffix>
    <localtime>4 Dec 2005 12:06:56</localtime>
    <isotime>2005-12-04 12:06:56 -0500</isotime>
    <utctime>2005-12-04 17:06:56</utctime>
    <dst>False</dst>
</timezone>



回答2:


If an external dependancy is not ideal (obviously this brilliant for client side geo location).

Then I recommend reading the answer to this question

Easiest Way to Convert lat lng/zip/city/state to Timezone in Ruby



来源:https://stackoverflow.com/questions/4669366/timezone-from-geolocation

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