Javascript examples for Date:getSeconds
The getSeconds() method returns the seconds from 0 to 59.
None
A Number, from 0 to 59, representing the seconds
The following code shows how to return the seconds, according to local time:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* ww w . java 2 s .co m*/ var d = new Date(); var n = d.getSeconds(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>