我可以使用谷歌地图api v3获取位置的时区吗? [英] Can I use google maps api v3 to get timezone of location?

查看:183
本文介绍了我可以使用谷歌地图api v3获取位置的时区吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用谷歌地图API来抓取时区?我已经在使用它的api进行地理编码和地图显示,我还想添加时区。但我在文档中找不到任何东西。



有什么想法?链接?

解决方案

您可以使用

  $。ajax({
url:https://maps.googleapis.com/maps/api/timezone/json?location=6.123123,106.213144& ; timestamp =+(Math.round((new Date()。getTime())/ 1000))。toString(),
})
.done(function(response){
if(response.data.timeZoneId!= null){
//做某事
}
});

您可以从GoogleMaps API获取位置坐标(经度/纬度)。



请注意,您会需要使用此API的特定密钥


Is it possible to use google maps api to grab timezone? I'm already using its api for geocoding and map display, I'd like to add timezone also. But I could not find anything in the documentation.

Any ideas? links?

解决方案

You can use the Timezone API.

For example (using jQuery) :

$.ajax({
   url:"https://maps.googleapis.com/maps/api/timezone/json?location=6.123123,106.213144&timestamp="+(Math.round((new Date().getTime())/1000)).toString(),
})
.done(function(response){
   if(response.data.timeZoneId != null){
     //do something
   }
});

You can get the location coordinates (latitude / longitude) from GoogleMaps API.

Note you'll need a specific key to use this API.

这篇关于我可以使用谷歌地图api v3获取位置的时区吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆