date conversion methods javascript 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: Javascript format date / time
var date = new Date('2014-8-20');
console.log((date.getMonth()+1) + '/' + date.getDate() + '/' + date.getFullYear());