-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (45 loc) · 1.37 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
<!DOCTYPE html>
<html>
<head>
<title>Days Since March 31, 2020 (UTC)</title>
<style>
body {
font-family: Arial, sans-serif;
}
#container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
}
#content {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div id="container">
<div id="content">
<h1>Days Since March 31, 2020 (UTC)</h1>
<p id="daysPassed">Calculating...</p>
</div>
</div>
<script>
// Define the target date (March 31, 2020) in UTC
const targetDate = new Date(Date.UTC(2020, 2, 31)); // Months are 0-based in JS
// Get the current date and time in UTC
const currentUtcTime = new Date().getTime() - new Date().getTimezoneOffset() * 60000;
const currentDate = new Date(currentUtcTime);
// Calculate the time difference between the current date and the target date
const timeDifference = currentDate - targetDate;
// Calculate the number of days passed
const daysPassed = Math.floor(timeDifference / (1000 * 3600 * 24));
// Update the text content of the element with id "daysPassed"
document.getElementById("daysPassed").textContent = `It has been ${daysPassed} days since March 31, 2020 (UTC).`;
</script>
</body>
</html>