-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (24 loc) · 674 Bytes
/
index.js
File metadata and controls
31 lines (24 loc) · 674 Bytes
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
29
30
31
const HoursEL=document.getElementById("Hours");
const MinutesEL=document.getElementById("Minutes");
const SecondsEL=document.getElementById("Seconds");
const AMPMEL=document.getElementById("AMPM");
function updateClock(){
let h = new Date().getHours()
let m = new Date().getMinutes()
let s = new Date().getSeconds()
let AMPM = "AM"
if (h > 12){
h = h - 12
AMPM = "PM"
}
h = h > 10 ? "0" + h : h;
m = m > 10 ? "0" + m : m;
s = s > 10 ? "0" + s : s;
HoursEL.innerText = h;
MinutesEL.innerText = m;
SecondsEL.innerText = s;
AMPMEL, (innertext = AMPM);
setTimeout(()=>{
}, 1000)
}
updateClock();