JavaScript getUTCSeconds() | Get the UTC Seconds

The JavaScript getUTCSeconds() method is used to get the seconds (0-59) of the UTC time. UTC stands for Universal Time Coordinated which is same as Greenwich Mean Time (GMT). Here is an example of the getUTCSeconds() to print the seconds of the UTC time:

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>
   
   <p id="xyz"></p>

   <script>
      const d = new Date();
      let min = d.getUTCSeconds();
      document.getElementById("xyz").innerHTML = min;
   </script>

</body>
</html>
Output

JavaScript getUTCSeconds() Syntax

The syntax of getUTCSeconds() method in JavaScript is:

x.getUTCSeconds()

where x must be an object of the Date() constructor.

The getUTCSeconds() method returns a number from 0 to 59 which will be the seconds of a date.

JavaScript Online Test


« Previous Tutorial Next Tutorial »



Like/Share Us on Facebook 😋