I want to display yesterday’s date by using JavaScript. For that, I use code as follows:
<p id="demo"></p>
<script type=text/javascript>
var d = new Date();
d.setDate(d.getDate() - 1);
document.getElementById("demo").innerHTML = d;
</script>
It works, but displays the date in complete format with time:
Sun May 01 2016 11:31:53 GMT-0700 (Pacific Daylight Time)
I want to show only day and date format like this:
Sun May 01 2016
Is there any solution for this?