To set the milliseconds using local time, use the setMilliseconds 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 SetUTCMSecDemo(nmsec){
var d = new Date();
d.setUTCMilliseconds(nmsec);
var s = d.toUTCString();
s += " and " + d.getUTCMilliseconds();
s += " milliseconds"
return(s);
}