So I’m a amateur and being learning online javascript but now I’m stuck on something I’m trying.
I’m getting a time from json in UTC format (eg. 16:00:00Z) and want to get in IST.
var main = function () {
json_url = "http://ergast.com/api/f1/current/next.json";
xhr = new XMLHttpRequest();
xhr.open("GET", json_url, false);
xhr.send(null);
weather = JSON.parse(xhr.responseText);
mydate = weather.MRData.RaceTable.Races[0].Qualifying.time;
mytime = Date(mydate);
mytime = mytime.toLocaleString();
return mytime
}
From what I understood online I tried adding
mytime = mytime.toLocaleString();
But that returns my local day, date and time and not time from json as I intended. Any help will be appreciated.