on google you can find a lot of tutorials for this for example:
https://www.shecodes.io/athena/2587-creating-a-clock-in-javascript#:~:text=You can make a clock,update the clock every second.
you will need to use setInterval to continually update the text with the latest time