-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (21 loc) · 904 Bytes
/
script.js
File metadata and controls
28 lines (21 loc) · 904 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
const desiredTime = new Date();
desiredTime.setUTCHours(8);
desiredTime.setUTCMinutes(15);
desiredTime.setUTCSeconds(0);
const timestamp = desiredTime.getTime();
const timeElement = document.getElementById("time");
timeElement.innerHTML = timestamp.toString();
console.log(timestamp);
document.addEventListener("DOMContentLoaded", function () {
// Get the current date and time
const currentDate = new Date();
// Update the day of the week
const dayOfWeekElement = document.getElementById("dayOfWeek");
const options = { weekday: "long" };
const dayOfWeek = currentDate.toLocaleDateString("en-US", options);
dayOfWeekElement.textContent = dayOfWeek;
// Update the UTC time
const timeElement = document.getElementById("time");
const timestamp = currentDate.getTime();
timeElement.textContent = timestamp.toString();
});