-
Notifications
You must be signed in to change notification settings - Fork 0
/
current-time.html
59 lines (55 loc) · 2.18 KB
/
current-time.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
58
59
<!--
Copyright (c) 2020-2021 Valère Monseur
Licensed under the terms of the MIT license - http://opensource.org/licenses/MIT
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="icon" href="/favicon.ico" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap"
/>
<link rel="stylesheet" href="css/current-time.css" />
<script
src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment-with-locales.min.js"
integrity="sha512-LGXaggshOkD/at6PFNcp2V2unf9LzFq6LE+sChH7ceMTDP0g2kn6Vxwgg7wkPP7AAtX+lmPqPdxB47A0Nz0cMQ=="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.33/moment-timezone-with-data.min.js"
integrity="sha512-rjmacQUGnwQ4OAAt3MoAmWDQIuswESNZwYcKC8nmdCIxAVkRC/Lk2ta2CWGgCZyS+FfBWPgaO01LvgwU/BX50Q=="
crossorigin="anonymous"
></script>
<title>Current time</title>
</head>
<body>
<script>
URLParams = new URLSearchParams(window.location.search);
if (URLParams.has("time") === true) {
time = moment(URLParams.get("time"), moment.ISO_8601);
} else {
time = moment();
}
timeUTC = moment.tz(time, "UTC").format();
timeLondon = moment.tz(time, "Europe/London").format();
timeParis = moment.tz(time, "Europe/Paris").format();
timeBrussels = moment.tz(time, "Europe/Brussels").format();
document.body.innerHTML =
"UTC : " +
timeUTC +
"<br />" +
"Europe/London : " +
timeLondon +
"<br />" +
"Europe/Paris : " +
timeParis +
"<br />" +
"Europe/Brussels : " +
timeBrussels;
</script>
</body>
</html>