Time calculation of various Timezones

function calcTime(sCity, offset)
{

// create Date object for current location
d = new Date();

// convert to msec
// add local time zone offset
// get UTC time in msec
utc = d.getTime() + (d.getTimezoneOffset() * 60000);

// create new Date object for different city
// using supplied offset
nd = new Date(utc + (3600000*offset));

// return time as a string
sDateTime = nd.toLocaleString(); // It is total datetime format

document.write(sCity+” : “+sDateTime);

}

// Set the time for countries
calcTime(‘London’, ‘+0.0′); // ‘+0.00′ is the standard timezone of London
calcTime(‘Sydney’, ‘+10.0′);
calcTime(‘New York’, ‘-5.0′);

Tags: ,

Leave a Reply

Recent Comments

  • registry fix programs: “Worked perfectly on my Windows VISTA & WINDOWS 7 PC. Fixed all the problems in a...
  • Host Gator deals: Good website. Added to Myspace!
  • Brittani Zufall: Thanks. I’m constantly interested in items and information on web site seo. You don’t...
  • computer technology information: Thanks I found just the info I already searched everywhere and just couldn’t...
  • TERESA HUTCHINSON: I have been looking around www.adiipl.com and really am impressed by the amazing content here. I...