Set both the seconds and milliseconds, according to UTC: - Javascript Date

Javascript examples for Date:setUTCSeconds

Description

Set both the seconds and milliseconds, according to UTC:

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  ww  . java 2 s  . c  om*/
    var d = new Date();
    d.setUTCSeconds(35, 825);
    var s = d.getUTCSeconds();
    var ms = d.getUTCMilliseconds();
    var x = document.getElementById("demo");
    x.innerHTML = s + ":" + ms;
}
</script>

</body>
</html>

Related Tutorials