How to use setMilliseconds in JavaScript
In this article, I will explain use of setMilliseconds() method in JavaScript date object.
JavaScript setMilliseconds() method
Syntax
Date.setMilliseconds(millisec)
|
Example
In the following example show to setMilliseconds() method set the milliseconds to 192.
<!DOCTYPE html>
<html>
<body>
<h3 style="color:Teal ">JavaScript setMilliseconds() Method Example</h3>
<p id="demo">Click for display the millisecond of a date time, after setting the millisecond.</p>
<button onclick="myFunction()">Try it</button>
<script type="text/javascript">
function myFunction() {
var d = new Date();
d.setMilliseconds(192);
var x = document.getElementById("demo");
x.innerHTML ="After setting of Milliseconds time is : "+ d.getMilliseconds();
}
</script>
</body>
</html>
|
Output1

Output2

You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here