<!DOCTYPE html>
<html>
<body>
<h2>Event</h2>
<button onclick="document.getElementById(‘fordate’).innerHTML = Date()">
Click to display Date and Time.</button>
<p id="fordate"></p>
</body>
</html>
—————————————————————————————————————————————-
<html>
<body>
<script type="text/javascript">
function displayDateTime() {
var currentDate = new Date();
var date = currentDate.getDate();
var month = currentDate.getMonth() + 1;
var year = currentDate.getFullYear();
var hours = currentDate.getHours();
var minutes = currentDate.getMinutes();
var seconds = currentDate.getSeconds();
document.getElementById("date-time").innerHTML =
date + "/" + month + "/" + year + " " + hours + ":" + minutes + ":" + seconds;
}
setInterval(displayDateTime, 1000);
</script>
<div id="date-time"></div>
</body>
</html>