Date getUTCSeconds() Method - Javascript Date

Javascript examples for Date:getUTCSeconds

Description

The getUTCSeconds() method returns the seconds (from 0 to 59), according to universal time.

UTC time is the same as GMT time.

Parameters

None

Return Value:

A Number, from 0-59, representing the seconds

The following code shows how to return the seconds, according to universal time:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from  w w  w  .ja  v  a  2  s . co m*/
    var d = new Date();
    var n = d.getUTCSeconds();
    document.getElementById("demo").innerHTML = n;
}
</script>

</body>
</html>

Related Tutorials