How to use getUTCSeconds in JavaScript

In this article, I will explain use of getUTCSeconds() method in JavaScript date object.
  • 1476

JavaScript date getUTCSeconds() method

  • getUTCSeconds() method of date object returns the seconds of the specified date according UTC.

  • In getUTCSeconds() method, The returned value is an integer number between 0 and 59.

  • Universal Coordinated Time (UTC) is is the same as GMT time and this time set by the World Time Standard.

Syntax

Date.getUTCSeconds()

Example

In the following example show to getUTCSeconds() method returns current time of seconds according to UTC.

<!DOCTYPE html>

<html>

<body>

<h3 style="color:ActiveCaption">JavaScript getUTCSeconds() Method Example</h3>

<p id="demo">Click for display seconds, according to UTC.</p>

<button onclick="myFunction()">Try it</button>

<script type="text/javascript">

    function myFunction() {

        var d = new Date();

        var x = document.getElementById("demo");

        x.innerHTML = document.write("According to UTC, Current Time Second is: " + d.getUTCSeconds());

    }

</script>

</body>

</html>

Output1

UTCSecond 1.jpg

Output2

UTCSecond 2.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

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.