Hello,
I recently created a [URL=”http://hpnpilot1200.org/clock/date.php”]page using php
So…I attempted to convert the page into javascript instead, but I’m having some difficulties. I found a few javascripts on the ‘net to accomplish the time updating, but it’s not exactly working.
This is the javascript I was working off of:
[code=php]<span id=”dt”></span>
<script type=”text/javascript”>
var currentTime = new Date()
var hours = currentTime.getUTCHours()
var minutes = currentTime.getUTCMinutes()
if (minutes < 10)
minutes = “0” + minutes
var seconds = currentTime.getUTCSeconds()
if (seconds < 10)
seconds = “0” + seconds
var UTCTime = hours + “:” + minutes + “:” + seconds;
setInterval(‘dispUTCtime()’, 1000);
function dispUTCtime() {
document.getElementById(‘dt’).innerHTML = UTCTime;
}
Using that code, the time appears, but the seconds/minutes/hours do not update per the setInterval. I also need to create additional scripts of the same type for different time zones. Any help is greatly appreciated and I look forward to working on this script.
Regards,
Jason H.