19 lines
467 B
HTML
19 lines
467 B
HTML
<div class="inline-block" id="clock"><p></p></div>
|
|
|
|
<script src="https://unpkg.com/spacetime"></script>
|
|
<script>
|
|
const clock = document.querySelector('#clock p');
|
|
|
|
const getTime = () => {
|
|
var d = spacetime(new Date(), 'Europe/Zurich')
|
|
return d.format('{hour-24-pad}:{minute-pad}:{second-pad}')
|
|
}
|
|
|
|
const setTime = () => {
|
|
clock.innerHTML = `<span class="time">${getTime()}</span> (CEST)`
|
|
}
|
|
|
|
|
|
setTime();
|
|
setInterval(setTime, 1000);
|
|
</script> |