Share via


setUTCMilliseconds Method (JScript 5.6) 

Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).


dateObj.setUTCMilliseconds(numMilli) 

Arguments

  • dateObj
    Required. Any Date object.
  • numMilli
    Required. A numeric value equal to the millisecond value.

Remarks

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.

Example

The following example illustrates the use of the setUTCMilliseconds method.

function SetUTCMSecDemo(nmsec){   

   var d, s;                           //Declare variables.

   var sep = ":";                      //Initialize separator.

   d = new Date();                     //Create Date object.

   d.setUTCMilliseconds(nmsec);        //Set UTC milliseconds.

   s = "Current setting is ";

   s += d.toUTCString() + sep + d.getUTCMilliseconds();

   return(s);                          //Return new setting.

}

Requirements

Version 3

Applies To: Date Object (JScript 5.6)

See Also

Reference

getMilliseconds Method (JScript 5.6)
getUTCMilliseconds Method (JScript 5.6)
setMilliseconds Method (JScript 5.6)