-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
28 lines (19 loc) · 1.03 KB
/
script.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
let clock = document.querySelector(".clock");
let hours = document.querySelector(".hours");
let minutes = document.querySelector(".minutes");
let seconds = document.querySelector(".seconds");
let date = document.querySelector(".date");
function timeNow(){
let nowClock = new Date()
hours.innerHTML = nowClock.getHours().toString().padStart(2,"0") + ": ";
minutes.innerHTML = nowClock.getMinutes().toString().padStart(2,"0") + ": ";
seconds.innerHTML = nowClock.getSeconds().toString().padStart(2,"0") ;
let days = ["MONDAY","TUESDAY","WEDSDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"];
let months = ["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"];
date.innerHTML = `
<span class="day">${days[nowClock.getDay()-1]}</span>
<span class="today">${nowClock.getDate().toString().padStart(2,"0")}</span>
<span class="month">${months[nowClock.getMonth()]}</span>
`
}
setInterval(timeNow, 1000);