Jump to content

[SOLVED] Javascript ServerTime clock.


DJTim666

Recommended Posts

I have coded a javascript servertime clock, but it doesn't seem to be working.

 

<script type="text/javascript">
<!--
var currenttime = '<?php echo $currentime; ?>';

var montharray=new Array('Jan','Feb','March','April','May','June','July','Aug','Sept','Oct','Nov','Dec');
var serverdate=new Date(currenttime);

function padlength(what){
var output=(what.toString().length==1)? '0'+what : what;
return output
}

function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1);
var timestring=padlength(serverdate.getHours())+':'+padlength(serverdate.getMinutes())+':'+padlength(serverdate.getSeconds());
document.getElementById('servertime').innerHTML=timestring+' EDT';
}

window.onload=function(){
setInterval('displaytime()', 1000);
}
//-->
</script>

 

--

DJ

Link to comment
https://forums.phpfreaks.com/topic/71290-solved-javascript-servertime-clock/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.