Home >>JavaScript Date Object Methods >JavaScript toDateString() Method

JavaScript toDateString() Method

JavaScript toDateString() Method

JavaScript toDateString() method is used to convert the given date of a Date object into a readable string. It does not accept any input parameters.

Syntax:
Date.toDateString()

Browser Support

Method Chrome Edge Firefox Safari Opera
toDateString() Yes Yes Yes Yes Yes
Here is an example of JavaScript toDateString() method:
<html>
<body>
<p>Click the button to see the Output.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() 
{
  var d = new Date();
  var n = d.toDateString();
  document.getElementById("demo").innerHTML = n;
}
</script>
</body>
</html>
Output:

Click the button to see the Output.