var Today = new Date(); var week, month; switch (Today.getDay()) { case 0: week = "Sunday"; break; case 1: week = "Monday"; break; case 2: week = "Tuesday"; break; case 3: week = "Wednesday"; break; case 4: week = "Thursday"; break; case 5: week = "Friday"; break; case 6: week = "Saturday"; break; } switch (Today.getMonth()) { case 0: month = "January"; break; case 1: month = "February"; break; case 2: month = "March"; break; case 3: month = "April"; break; case 4: month = "May"; break; case 5: month = "June"; break; case 6: month = "July"; break; case 7: month = "August"; break; case 8: month = "September"; break; case 9: month = "October"; break; case 10: month = "November"; break; case 11: month = "December"; break; } var timerID = null; var timerRunning = false; var timeValue = ""; function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function showtime () { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds() timeValue = "" + ((hours >12) ? hours -12 :hours) if (timeValue == "0") timeValue = 12; timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds timeValue += (hours >= 12) ? " P.M." : " A.M." timeValue = week + ", " + month + " " + Today.getDate() + ", " + Today.getYear() + " " + timeValue; document.getElementById("time").innerHTML = "

" + timeValue + "

"; timerID = setTimeout("showtime()",1000); timerRunning = true; } function startclock() { stopclock(); showtime(); }