blob: 3e5650dade9bbc5e8261e920ea1864179e17f56a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
function updateTime(){
var date = new Date()
var hours = date.getHours()
var minutes = date.getMinutes()
var seconds = date.getSeconds()
var old_hours = hours;
if (hours > 12) {
hours = hours - 12
} else if (hours == 0) {
hours = 12
}
if (minutes < 10) {
minutes = "0" + minutes
}
var t_str = hours + ":" + minutes;
if (old_hours > 11) {
t_str += " pm";
} else {
t_str += " am";
}
document.getElementById('time').innerHTML = t_str;
}
setInterval(updateTime, 1);
|