Note that there are some explanatory texts on larger screens.

plurals
  1. POerror with using localtime conversion in javascript time function
    primarykey
    data
    text
    <pre><code>&lt;script type="text/javascript"&gt; //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&gt;=12) dn="PM" if (hours&gt;12){ hours=hours-12 hours="0"+hours } if (hours==0) hours=12 if (minutes&lt;=9) minutes="0"+minutes if (seconds&lt;=9) seconds="0"+seconds var cdate="&lt;strong&gt;&lt;font color='b9b9b9' size='1'&gt; "+hours+":"+minutes+":"+seconds+" "+dn+"&lt;/font&gt;&lt;/strong&gt;" if (document.all) document.all.clock.innerHTML=cdate else if (document.getElementById) document.getElementById("clock").innerHTML=cdate else document.write(cdate) } if (!document.all&amp;&amp;!document.getElementById) getthedate() function live_servertime(){ if (document.all||document.getElementById) setInterval("getthedate()",1000) } // get London time alert(getthedate('London', '+1')); &lt;/script&gt; </code></pre> <p>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: <a href="https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6016329.html" rel="nofollow noreferrer">Javascript hack link</a></p> <p>However, using my above code, all that is displayed is: <em>NaN:NaN:Nan AM</em> Does anyone know how to make this work?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload