时区 API INVALID_REQUEST

ste*_*xx1 2 javascript jquery google-maps-api-3

我似乎无法找到是什么原因造成的。我一遍又一遍地检查这个网址,但我似乎找不到它有什么问题。

function setTime() {
min = $("#minutes").val();
hour = $("select").val();
odG = $("#odGodina").val();
doG = $("#doGodina").val();
dat = $("#datepicker").val();
dat = dat.split("/"); //mm.dd.YYYY
vreme = new Date(dat[2], dat[0], dat[1], hour, min);
sendInput(vreme);
}
function sendInput(time) {
console.log(time.getTime());
var url = "https://maps.googleapis.com/maps/api/timezone/json?location="+lat+","+lngt+"&timestamp="+time.getTime()+"&sensor=false";
var testResenje = $.ajax({ 
    url: url, 
    }).done(function(response) {
        offset = response.rawOffset / 3600 + response.dstOffset / 3600;
        sendResponse();
        console.log(offset);
    });}
Run Code Online (Sandbox Code Playgroud)

获取构建的 url 是:

https://maps.googleapis.com/maps/api/timezone/json?location=44.7220401,21.175114500000063×tamp=1455189900000&sensor=false

long 和 lat 的字符数有问题吗?

还是我的函数顺序不好?

编辑:事实证明,如果我在时间戳中少一个字符,它就可以工作。这是否意味着我无法使用当前时间?

小智 6

Google timezoneapi 期望时间戳为秒,因为 unix 时间戳表示的不是毫秒。

timestamp 将所需时间指定为自 UTC 1970 年 1 月 1 日午夜以来的秒数。

参考: https: //developers.google.com/maps/documentation/timezone/intro