DJTim666 Posted September 30, 2007 Share Posted September 30, 2007 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 Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted September 30, 2007 Author Share Posted September 30, 2007 Ok I figured it out and now it works. Is there any way to display regular hours instead of the 24 hour clock? EDIT: FIXED. TOPIC SOLVED. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.