10 lines
340 B
JavaScript
10 lines
340 B
JavaScript
function updateTime() {
|
|
const timeElement = document.getElementById('time');
|
|
const now = new Date();
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
timeElement.textContent = `${hours}:${minutes}`;
|
|
}
|
|
setInterval(updateTime, 1000);
|
|
updateTime();
|