Date getUTCSeconds() Method - Javascript Date

Javascript examples for Date:getUTCSeconds


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

UTC time is the same as GMT time.



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>

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

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

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;


Related Tutorials