javascript - time zone api INVALID_REQUEST -
i can't seem find causing this. checked url again , again , can't seem find wrong it.
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+"×tamp="+time.gettime()+"&sensor=false"; var testresenje = $.ajax({ url: url, }).done(function(response) { offset = response.rawoffset / 3600 + response.dstoffset / 3600; sendresponse(); console.log(offset); });}
the url gets build is:
is there problem number of characters long , lat have?
or function order bad?
edit: turns out if have 1 less character in timestamp works. mean can't use current time?
google timezoneapi expects timestamp seconds how unix timestamp represents not milliseconds.
timestamp specifies desired time seconds since midnight, january 1, 1970 utc.
ref: https://developers.google.com/maps/documentation/timezone/intro.
Comments
Post a Comment