How do I use a different time zone time in a JavaScript?
I already know how to get the current system time but I am confused how to display different time zone time. This one is displaying as an alert, but I need it as a usual displayer not as an alert.
function calcTime(city, offset) {
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000*offset));
return "The local time in " + city + " is " + nd.toLocaleString();
}
alert(calcTime('U.S.A', '-5.0'));