JavaScript
const clock = () => {
const d = new Date();
let year = d.getFullYear();
let month = clockFormat(d.getMonth() + 1);
let date = clockFormat(d.getDate());
const weekday = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
let day = weekday[d.getDay()];
let hour = clockFormat(d.getHours());
let min = clockFormat(d.getMinutes());
let sec = clockFormat(d.getSeconds());
let today = `${year}.${month}.${date} ${day}`;
let time = `${hour}:${min}:${sec}`;
document.querySelector(".clock-date").innerText = today;
document.querySelector(".clock-time").innerText = time;
};
const clockFormat = (t) => {
return String(t).padStart(2, '0');
};
clock();
setInterval(clock, 1000);