-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
57 lines (47 loc) · 1.24 KB
/
index.html
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!-- Hi this is simple digital clock with glowing effect made with a little css and js -->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Digital Clock</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="Time-Zone" >
<button >IST</button>
</div>
<div id="center" class="wrapper">
<div class="display">
<div id="time"></div>
</div>
</div>
<script>
setInterval(() => {
const time = document.querySelector(".display #time");
let date = new Date();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
let millisec = Math.floor(date.getMilliseconds() / 10).toFixed(0);
let day_night = "AM";
if (hours > 12) {
day_night = "PM";
hours = hours - 12;
}
if (seconds < 10) {
seconds = "0" + seconds;
}
if (millisec < 10) {
millisec = "0" + millisec;
}
if (minutes < 10) {
minutes = "0" + minutes;
}
if (hours < 10) {
hours = "0" + hours;
}
time.textContent = hours + ":" + minutes + ":" + seconds + ":" + millisec + " " + day_night;
});
</script>
</body>
</html>