This documentation is archived and is not being maintained.

setMilliseconds Method

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

function setMilliseconds(numMilli : Number)

Arguments

numMilli
Required. A numeric value equal to the millisecond value.

Remarks

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.

Example

The following example illustrates the use of the setMilliseconds method.

function SetMSecDemo(nmsec){
   var d, s;                    //Declare variables.
   var sep = ":";               //Initialize separator.
   d = new Date();              //Create Date object.
   d.setMilliseconds(nmsec);    //Set milliseconds.
   s = "Current setting is ";
   s += d.toLocaleString() + sep + d.getMilliseconds();
   return(s);                   //Return new date setting.
}

Requirements

Version 3

See Also

getMilliseconds Method | getUTCMilliseconds Method | setUTCMilliseconds Method

Applies To: Date Object

Show: