I am trying to show the next whole minute in a clock. When I increment the min with min++
the display shows 60 mins then changes the hour 1 second later.
How do I change it?
function getClockTime_2() {
let date = new Date();
let hr = date.getHours();
let min = date.getMinutes();
min++ // causes the min to go to 60 and change the hour one second later.
hr = ("0" + hr).slice(-2);
min = ("0" + min).slice(-2);
let clock24 = document.getElementById("clockDiv2");
clock24.innerHTML = `${hr}:${min}:00`;
}
setInterval(getClockTime_2, 1000);