Current time (clock widget)

Hi, I was wondering if it is possible to add a live current time (clock) to our page using some kind of css / code.

1 Like

I am currently wondering the same thing !
If you found a solution let us know here :wink:

Yes would love to know if solution was found as well. Thanks!

here is a simple one:

Paste this code inside a customcodewidget and change to your needs.

<div class="clock">

    font-family: sans-serif, "Source Sans Pro";
    color: #000;
    font-size: 100px;

  const currentTime = () => {
  const el = document.querySelector('.clock');
  let date = new Date();
  let hh = date.getHours();
  let mm = date.getMinutes();
  let ss = date.getSeconds();
  hh = hh < 10 ? `0${hh}` : hh;
  mm = mm < 10 ? `0${mm}` : mm;
  ss = ss < 10 ? `0${ss}` : ss;
  let time = `${hh}:${mm}:${ss}`;
  el.innerHTML = time;

setInterval(currentTime, 1000);
1 Like

THANK YOU! Much appreciated :slight_smile:

Thanks for the code. It appears only after double refreshing age. Do you know what the problem is?

works flawlessly here…

Is this something that you have to change daily? Or does it go on forever once you put in the current date and time? Thank you for the code! And thank you in advance!