Hello, I consider myself an amateur in the world of online javascript learning. Currently, I have come across a challenge that has left me stuck.
I am working with a JSON time data provided in UTC format (e.g. 16:00:00Z) and my goal is to convert it to 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
}
After doing some research online, I attempted adding the following:
mytime = mytime.toLocaleString();
Unfortunately, this only returns my local day, date, and time rather than the intended time from the JSON data. Any assistance on this matter would be greatly appreciated.