How to use ToUTCString in JavaScript

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

JavaScript toUTCString() Method

UTC stand for Universal Coordinated Time. JavaScript toUTCString() method use for convert Date object in string format according to UTC. The UTC time set by  World Time Standard.

Syntax

Date.toUTCString()

Example

<html>

<head>

    <script type="text/javascript">

        function myfun() {

            var dd = new Date();

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

            mm.innerHTML = dd.toUTCString();

        }

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

 

 ToUtcNNN.jpg

 

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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.