Source Code:
(back to article)
Submit
Result:
Report an issue
<html> <head> <title>Show current time</title> </head> <body> <div id="currentTime"></div> <script> const element = document.getElementById('currentTime'); setInterval(function () { const currentDate = new Date(); element.innerText = currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds(); }, 1000); </script> </body> </html>