Home >>JavaScript Date Object Methods >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()
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
toDateString() | Yes | Yes | Yes | Yes | Yes |
<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>
Click the button to see the Output.