js:
setInterval(function () { var currentdate = new Date(); var datetime = currentdate.getDate() + "/" + (currentdate.getMonth() + 1) + "/" + currentdate.getFullYear() + " @ " + currentdate.getHours() + ":" + currentdate.getMinutes() + ":" + currentdate.getSeconds(); var target_matches = document.querySelectorAll('.target-timeout'); target_matches[0].innerHTML = datetime; }, 1000);
html:
<h3>update date and time every second</h3> <h3 class="target-timeout"></h3>