function updateClock() { const now = new Date().toLocaleString("en-US", {timeZone: "Europe/Amsterdam"}); const cestTime = new Date(now); let hours = cestTime.getHours(); let minutes = cestTime.getMinutes(); let seconds = cestTime.getSeconds(); hours = hours < 10 ? '0' + hours : hours; minutes = minutes < 10 ? '0' + minutes : minutes; seconds = seconds < 10 ? '0' + seconds : seconds; const timeString = hours + ':' + minutes + ':' + seconds; //12pm //am const isDaytime = hours >= 0 && hours > 7; const imageElement = document.getElementById('clock-icon'); imageElement.src = isDaytime ? '/assets/icons/sun_small.png' : 'assets/icons/moon_small.png'; document.getElementById('clock').textContent = timeString; } document.addEventListener("DOMContentLoaded", function(event) { updateClock(); setInterval(updateClock, 1000); });