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 Link to comment https://forums.phpfreaks.com/topic/71290-solved-javascript-servertime-clock/ 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. Link to comment https://forums.phpfreaks.com/topic/71290-solved-javascript-servertime-clock/#findComment-358615 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.