How to use ToLocaleString in JavaScript

In this article I am going to explain about toLocaleString() method in JavaScript
  • 1763

JavaScript toLocaleString() Method

JavaScript toLocaleString() method also use for convert date object in string format but its use local setting for convert date object in string format.

Syntax

Date.toLocaleString()

Example

<html>

<head>

    <script type="text/javascript">

        function myfun() {

            var dd = new Date();

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

            mm.innerHTML = dd.toLocaleString();

        }

    </script>

</head>

<body>

    <p>

        click button to show Date</p>

    <h4 id="tst" style="color: Blue">

    </h4>

    <button onclick="myfun()">

        click me</button>

</body>

</html>


Output

 

 tolocalString.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

© 2019 DotNetHeaven. All rights reserved.