Code:
<!DOCTYPE html>
<html>
<body>
<h2>Today's Date and Time using javascript</h2>
<p id="demo"></p>
<script>
const d = new Date();
document.getElementById("demo").innerHTML = d;
</script>
</body>
</html>
Output:
Source: W3School
The Tech Platform
Comments