Javascript examples for Date:setSeconds
Set both the seconds and milliseconds:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww .ja va2 s . c o m var d = new Date(); d.setSeconds(35, 825); var s = d.getSeconds(); var ms = d.getMilliseconds(); var x = document.getElementById("demo"); x.innerHTML = s + ":" + ms; } </script> </body> </html>