Created
December 2, 2025 13:57
-
-
Save atrakic/e60555ea5ba020dcef296176ef3aaba6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Multi Time Zone Digital Clock</title> | |
| <style> | |
| body { font-family: 'Roboto Mono', 'monospace', sans-serif; background: #222; color: #fff; margin: 0; padding: 2em;} | |
| .clock-container { display: flex; flex-wrap: wrap; gap: 2em; } | |
| .clock-box { background: #333; padding: 1em 2em; border-radius: 1em; box-shadow: 0 2px 8px #1119;} | |
| .zone-name { font-size: 1.1em; font-weight: bold; margin-bottom: 0.5em;} | |
| .time-value { font-size: 2.3em; letter-spacing: 0.09em;} | |
| .date-value { font-size: 0.95em; opacity: 0.7;} | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Digital Clocks for Multiple Time Zones</h1> | |
| <div class="clock-container" id="clocks"></div> | |
| <script> | |
| // Define time zones to display | |
| const timeZones = [ | |
| { name: "UTC", tz: "UTC" }, | |
| { name: "New York (EST)", tz: "America/New_York" }, | |
| { name: "London", tz: "Europe/London" }, | |
| { name: "Central Europe", tz: "Europe/Berlin" }, | |
| { name: "Tokyo", tz: "Asia/Tokyo" } | |
| ]; | |
| // Initialize clock boxes | |
| const clocksDiv = document.getElementById('clocks'); | |
| timeZones.forEach((zone, idx) => { | |
| const box = document.createElement('div'); | |
| box.className = 'clock-box'; | |
| box.innerHTML = ` | |
| <div class="zone-name">${zone.name}</div> | |
| <div class="time-value" id="time-${idx}"></div> | |
| <div class="date-value" id="date-${idx}"></div> | |
| `; | |
| clocksDiv.appendChild(box); | |
| }); | |
| function updateClocks() { | |
| const now = new Date(); | |
| timeZones.forEach((zone, idx) => { | |
| const timeStr = now.toLocaleTimeString('en-US', { | |
| hour: '2-digit', minute: '2-digit', second: '2-digit', | |
| hour12: false, | |
| timeZone: zone.tz, | |
| }); | |
| const dateStr = now.toLocaleDateString('en-US', { | |
| year: 'numeric', month: 'long', day: '2-digit', | |
| timeZone: zone.tz, | |
| }); | |
| document.getElementById(`time-${idx}`).textContent = timeStr; | |
| document.getElementById(`date-${idx}`).textContent = dateStr; | |
| }); | |
| } | |
| updateClocks(); | |
| setInterval(updateClocks, 1000); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment