-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.js
More file actions
34 lines (23 loc) · 693 Bytes
/
clock.js
File metadata and controls
34 lines (23 loc) · 693 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
32
33
34
var sec = new Date().getSeconds();
var min = new Date().getMinutes();
var hours = new Date().getHours();
var hourtag = document.getElementById("id1");
var mintag = document.getElementById("id2");
var sectag = document.getElementById("id3");
var context = document.getElementById("id4");
time();
function time()
{
sec = new Date().getSeconds();
min = new Date().getMinutes();
hours = new Date().getHours();
if(hours<12){
context.innerText = "AM";
}
else
context.innerText = "PM";
hourtag.innerText = `H: ${hours}`;
mintag.innerText = `M: ${min}`;
sectag.innerText =`S: ${sec}`;
}
setInterval(time,1000);