intervalles
/* Place your JavaScript in this file */
let CLOCK_SECONDS = 0;
let CLOCK_MINUTES = 0;
let CLOCK_HOURS = 0;
let CLOCK_DAY = 0
let CLOCK_MONTH = 0;
let CLOCK_YEAR = 0;
setInterval(function (){
let DATE_CLOCK = new Date()
CLOCK_SECONDS = DATE_CLOCK.getSeconds();
CLOCK_MINUTES = DATE_CLOCK.getMinutes();
CLOCK_HOURS = DATE_CLOCK.getHours();
CLOCK_YEAR = DATE_CLOCK.getFullYear();
CLOCK_MONTH = DATE_CLOCK.getMonth()+1;
CLOCK_DAY = DATE_CLOCK.getDate();
document.getElementById("main").textContent = ("TIME: " +check(CLOCK_HOURS)) + ":" +check(CLOCK_MINUTES) + ":"+check(CLOCK_SECONDS);
document.getElementById("main2").textContent = ("DATE: " + check(CLOCK_MONTH)) + "/" + check(CLOCK_DAY) + "/" + check(CLOCK_YEAR)
},1000)
function check(x){
if (x < 10){
return "0" + x.toString();
}else {
return x.toString()
}
}
Arnav Katyal