I'm trying to use google Time Zone API. I provide the longitude and latitude and the API give me the timezone.
How can I get the local time with this following value (dstOffset and rawOffset) ?
Here is the Json
{
"dstOffset" : 0.0,
"rawOffset" : -28800.0,
"status" : "OK",
"timeZoneId" : "America/Los_Angeles",
"timeZoneName" : "Pacific Standard Time"
}
I have tried this javascript function but I don't get the correct time.
function calcTime(offset) {
var d = new Date();
var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
var nd = new Date(utc + (3600000*offset));
alert("The local time is " + nd.toLocaleString());
}
calcTime(-28800.0);
Thanks for your help !