new Date() creates a new date object with the current date and time
<p id="divdemo"></p>
<script>
var dt = new Date();
document.getElementById("divdemo").innerHTML = dt;
</script>
OUTPUT
Sat Mar 07 2020 18:01:22 GMT+0530 (India Standard Time)
2020-03-07