To set the milliseconds value using Coordinated Universal Time (UTC), use the setUTCMilliseconds method.
If the value of numMilli is greater than 999 or is a negative number, the stored number of seconds (and minutes, hours, and so forth if necessary) is incremented an appropriate amount.
function SetMSecDemo(nmsec){
var d = new Date();
d.setMilliseconds(nmsec);
var s = ""
s += d.toLocaleString();
s += " and " + d.getMilliseconds();
s += " milliseconds";
return(s);
}