-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdgclock.html
More file actions
41 lines (36 loc) · 803 Bytes
/
dgclock.html
File metadata and controls
41 lines (36 loc) · 803 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
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital clock</title>
<link rel="stylesheet" href="dgclock.css">
</head>
<body>
<div id="clock"></div>
<script>
function showTime(){
var date = new Date();
var h = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds();m
var session = "AM";
if(h == 0)
{
h =12;
}
if(h>12){
h =h -12;
session = "PM";
}
h = (h<10) ? "0"+h:h;
m = (m<10) ? "0"+m:m;
s = (s<10) ? "0"+s:s;
document.getElementById("clock").innerHTML = h + ":" + m + ":"+ s+"";
setTimeout(showTime,1000);
}
showTime();
</script>
</body>
</html>