SoFunction
Updated on 2025-03-03

Detailed explanation of the use of getUTCSeconds method in JavaScript

The javascript () method returns seconds on the specified date according to the common time. The value returned by getUTCSeconds is an integer between 0 and 59.
grammar

()

The following are the detailed information of the parameters:

  •     NA

Return value:

Returns the number of seconds on the specified date according to the general time.
example:

In the following example, print the number of seconds part of the current time to the variable hrs.

<html>
<head>
<title>JavaScript getUTCSeconds Method</title>
</head>
<body>
<script type="text/javascript">
  var dt = new Date();
  ("getUTCSeconds() : " + () ); 
</script>
</body>
</html>

This will produce the following results:

getUTCSeconds() : 14