<script type="text/javascript">
//Live Javascript Server Time
function getthedate(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));
var hours = nd.getHours()
var minutes = nd.getMinutes()
var seconds = nd.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
hours="0"+hours
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate="<strong><font color='b9b9b9' size='1'> "+hours+":"+minutes+":"+seconds+" "+dn+"</font></strong>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function live_servertime(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
// get London time
alert(getthedate('London', '+1')); </script>
Hey. I wanted to display the live time of a server (if I know its timezone/utc offset) by using this hack on a simple browser live time script: Javascript hack link
However, using my above code, all that is displayed is: NaN:NaN:Nan AM Does anyone know how to make this work?