opensourceuser
Technical User
19.08.07 :: 19:49 hours
Dear Javascripters
Am hardly able to descibe myself as a professional . . at anything . . but i do have need of your esteemed help to complete this script to output to browsers . . currently the script is programmed to deliver a pop-up to users . . and it does . . just fine . . but try as i might to get the output to page - is a dismal failure . . here is the script in entirety . . please advise . .
yours sincerely
stuart - opensourceuser
Dear Javascripters
Am hardly able to descibe myself as a professional . . at anything . . but i do have need of your esteemed help to complete this script to output to browsers . . currently the script is programmed to deliver a pop-up to users . . and it does . . just fine . . but try as i might to get the output to page - is a dismal failure . . here is the script in entirety . . please advise . .
Code:
<script type="text/javascript">
// function to calculate local time
// in a different city
// given the city's UTC offset
function calcTime(city, 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
return "The local time in " + city + " is " + nd.toLocaleString();
}
// get New Zealand time
alert(calcTime('Wellington', '+12'));
</script>
yours sincerely
stuart - opensourceuser