1function updateTime(){
2 var currentTime = new Date()
3 var hours = currentTime.getHours()
4 var minutes = currentTime.getMinutes()
5 if (minutes < 10){
6 minutes = "0" + minutes
7 }
8 var t_str = hours + ":" + minutes + " ";
9 if(hours > 11){
10 t_str += "PM";
11 } else {
12 t_str += "AM";
13 }
14 document.getElementById('time_span').innerHTML = t_str;
15}
16setInterval(updateTime, 1000);