gpt4 book ai didi

javascript - 时区 API INVALID_REQUEST

转载 作者:行者123 更新时间:2023-12-03 07:55:20 24 4
gpt4 key购买 nike

我似乎找不到造成这种情况的原因。我一遍又一遍地检查该网址,但似乎找不到问题所在。

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);
});}

获取构建的 url 是:

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

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

或者我的函数顺序不好?

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

最佳答案

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

timestamp specifies the desired time as seconds since midnight, January 1, 1970 UTC.

引用:https://developers.google.com/maps/documentation/timezone/intro .

关于javascript - 时区 API INVALID_REQUEST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34821578/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com