How to use ToDateString in JavaScript

In this article I am going to explain about toDateString() method in JavaScript.
  • 3097

JavaScript ToDateString() Method

JavaScript TodateString() method use for convert Date of date object in to string format. toDatestring method only use for date format not use for time format.

Syntax

Date.toDateString()

Example

<html>

<head>

    <script type="text/javascript">

        function myfun() {

            var dd = new Date();

            var mm = document.getElementById("tst");

            mm.innerHTML = dd.toDateString();

        }

    </script>

</head>

<body>

    <p>

        click button to show Date</p>

    <h1 id="tst" style="color: Blue" s>

    </h1>

    <button onclick="myfun()">

        click me</button>

</body>

</html>

 

Output

 

 toDateString.jpg

 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.