setUTCMilliseconds Method (Windows Scripting - JScript)

 

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

Syntax

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.

The following example illustrates the use of the setUTCMilliseconds method.

function SetUTCMSecDemo(nmsec){   
// Create Date object.
   var d = new Date();           
// Set UTC milliseconds.
   d.setUTCMilliseconds(nmsec);  

   var s = "Current setting is ";
   s += d.toUTCString();
   s += " and " + d.getUTCMilliseconds();
   s += " milliseconds"
   return(s);
}

Requirements

Version 3

Applies To: Date Object (Windows Scripting - JScript)

Change History

Date

History

Reason

March 2009

Improved output from sample code.

Content bug fix.

See Also

getMilliseconds Method (Windows Scripting - JScript)
getUTCMilliseconds Method (Windows Scripting - JScript)
setMilliseconds Method (Windows Scripting - JScript)