-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.js
More file actions
45 lines (35 loc) · 946 Bytes
/
Copy pathclock.js
File metadata and controls
45 lines (35 loc) · 946 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function updateClock() {
const now = new Date();
const giorni = [
"Domenica",
"Lunedì",
"Martedì",
"Mercoledì",
"Giovedì",
"Venerdì",
"Sabato"
];
const mesi = [
"Gennaio",
"Febbraio",
"Marzo",
"Aprile",
"Maggio",
"Giugno",
"Luglio",
"Agosto",
"Settembre",
"Ottobre",
"Novembre",
"Dicembre"
];
const ore = String(now.getHours()).padStart(2, "0");
const minuti = String(now.getMinutes()).padStart(2, "0");
const secondi = String(now.getSeconds()).padStart(2, "0");
document.getElementById("clock").textContent =
`${ore}:${minuti}:${secondi}`;
document.getElementById("date").textContent =
`${giorni[now.getDay()]} ${now.getDate()} ${mesi[now.getMonth()]} ${now.getFullYear()}`;
}
updateClock();
setInterval(updateClock,1000);