-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
53 lines (42 loc) · 1.32 KB
/
index.html
File metadata and controls
53 lines (42 loc) · 1.32 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<div class="card">
<div class="card-body" id="clock">
<div id="clock"></div>
</div>
</div>
<script>
function displayTime(){
var nowDate = new Date();
var nowHour = nowDate.getHours();
var nowMin = nowDate.getMinutes();
var nowSec = nowDate.getSeconds();
if(nowSec<10){
nowSec = "0" + nowSec;
}else{
nowSec = nowSec;
}
if(nowMin<10){
nowMin = "0" + nowMin;
}else{
nowMin = nowMin;
}
if(nowHour<10){
nowHour = "0" + nowHour;
}else{
nowHour = nowHour;
}
document.getElementById("clock").innerHTML = nowHour + ":" + nowMin + ":" + nowSec;
}
setInterval(displayTime,1000);
</script>
</body>
</html>