javascript time format string code example
Example 1: javascript full date as string
<p>The toDateString() method converts a date to a date string:</p>
<p id="demo"></p>
<script>
var d = new Date();
document.getElementById("demo").innerHTML = d.toDateString();
</script>
//output: Fri Oct 16 2020
Example 2: js datetime format
new Date().toISOString().slice(0, 16).replace("T", " ")