Date toDateString() Method - Javascript Date

Javascript examples for Date:toDateString

Description

The toDateString() method converts the date of a Date object into a readable string.

Parameters

None

Return Value:

A String, representing the date as a string

The following code shows how to Convert today's date into a readable string:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials