Javascript examples for Date:toDateString
The toDateString() method converts the date of a Date object into a readable string.
None
A String, representing the date as a string
The following code shows how to Convert today's date into a readable string:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//w w w . j av a2s. c om var d = new Date(); var n = d.toDateString(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>