timekeeper-prime / script.js
ymk11's picture
Make some thing like this but remove the bar from the top
ce183fc verified
function updateClock() {
// Get current time adjusted for GMT+2
const now = new Date();
const gmtOffset = 2 * 60 * 60 * 1000; // GMT+2 in milliseconds
const gmtPlus2Time = new Date(now.getTime() + gmtOffset);
// Format time as HH:MM:SS
const hours = String(gmtPlus2Time.getHours()).padStart(2, '0');
const minutes = String(gmtPlus2Time.getMinutes()).padStart(2, '0');
const seconds = String(gmtPlus2Time.getSeconds()).padStart(2, '0');
// Format date
const options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
};
const dateString = gmtPlus2Time.toLocaleDateString('en-US', options);
// Update DOM
document.getElementById('time').textContent = `${hours}:${minutes}:${seconds}`;
document.getElementById('date').textContent = dateString;
// Timezone information
const timezoneInfo = Intl.DateTimeFormat().resolvedOptions().timeZone;
document.getElementById('timezone').textContent = `GMT+2 (${timezoneInfo})`;
}
// Update clock immediately and then every second
updateClock();
setInterval(updateClock, 1000);