aboutsummaryrefslogtreecommitdiff
path: root/static/time.js
blob: ac093b1a50d9f04b26b675d19272fc3cdd399915 (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
28
var colon = ":";
function updateTime(){
  var date = new Date()
  var hours = date.getHours()
  var minutes = date.getMinutes()

  if (hours > 11)
    var tod = " pm";
  else
    var tod = " am";

  if (hours > 12)
    hours = hours - 12
  else if (hours == 0)
    hours = 12

  if (minutes < 10)
    minutes = "0" + minutes

  if (colon === ":") 
    colon = " ";
  else if (colon === " ")
    colon = ":";

  var t_str = hours + colon + minutes + tod;
  document.getElementById('time').innerHTML = t_str;
}
setInterval(updateTime, 500);