Export (0) Print
Expand All

setMilliseconds Method

Updated: March 2009

Sets the milliseconds value in the Date object using local time.

function setMilliseconds(numMilli : Number)

numMilli

Required. A numeric value equal to the millisecond value.

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.

The following example illustrates the use of the setMilliseconds method.

function SetMSecDemo(nmsec){
    var d = new Date();
    d.setMilliseconds(nmsec);

    var s = ""
    s += d.toLocaleString();
    s += " and " + d.getMilliseconds();
    s += " milliseconds";
    return(s);
}

Date

History

Reason

March 2009

Improved output from example code.

Content bug fix.

Community Additions

ADD
Show:
© 2014 Microsoft