-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreal-time-clock-display.html
50 lines (50 loc) · 1.37 KB
/
real-time-clock-display.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Real-Time Clock Display</title>
<style>
* { border-sizing: border-box; }
body { font-family:monospace; font-size:12pt; }
p { text-align:right; padding:1em; }
.label {
font-family:monospace;
font-size:8pt;
font-style:italic;
text-align: right;
padding:1em;
margin:1em;
margin-right:0;
border:1px solid gray;
}
#time,
#UTC {
font-family:monospace;
font-size:12pt;
font-weight:bold;
margin:1em;
margin-left:0;
padding:1em;
text-align:center;
border:1px solid blue;
}
#time {
}
#UTC {
}
</style>
</head>
<body>
<p>Universal Time Coordinated: <span id="UTC"></span></p>
<p>Local System Time: <span id="time"></span></p>
<script>
var utcDisplay = document.getElementById("UTC");
var timeDisplay = document.getElementById("time");
function refreshTime() {timeDisplay.innerHTML = new Date().toString(); }
function refreshUTC() { utcDisplay.innerHTML = new Date().toUTCString(); }
function refreshClocks() { refreshTime();refreshUTC(); }
setInterval(refreshClocks, 1000);
</script>
</body>
</html>