-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
63 lines (53 loc) · 1.21 KB
/
app.js
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
60
61
62
63
function clock() {
let hour = document.getElementById("hour");
let minutes = document.getElementById("minute");
let seconds = document.getElementById("second");
let month = document.getElementById("month");
let date = document.getElementById("date");
let day = document.getElementById("day");
let h = new Date().getHours();
let m = new Date().getMinutes();
let s = new Date().getSeconds();
const months = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
const days = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
let mont = new Date().getMonth();
let d = new Date().getDate();
let y = new Date().getFullYear();
let dy = new Date().getDay();
h = h % 12;
h = h ? h : 12;
h = h < 10 ? "0" + h : h;
m = m < 10 ? "0" + m : m;
s = s < 10 ? "0" + s : s;
d = d < 10 ? "0" + d : d;
mont = months[mont].slice(0, 3);
dy = days[dy].slice(0, 3);
day.innerHTML = dy;
month.innerHTML = mont;
date.innerHTML = d;
hour.innerHTML = h;
minutes.innerHTML = m;
setTimeout(clock, 1000);
}
clock();