Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.
Microsoft® JScript®
setMilliseconds Method
 Language Reference 
Version 3 

See Also                  Applies To


Description
Sets the milliseconds value in the Date object using local time.
Syntax
objDate.setMilliseconds(numMilli)

The numMilli argument is a numeric value equal to the millisecond value.

Remarks
All set methods taking optional arguments use the value returned from corresponding get methods, if you do not specify an optional argument. For example, if the numMonth argument is optional, but not specified, JavaScript uses the value returned from the getMonth method.

To set the milliseconds value using Universal Coordinated 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, s;
  var sep = ":";
  d = new Date();
  d.setMilliseconds(nmsec);
  s = "Current setting is ";
  s += d.toLocaleString() + sep + d.getMilliseconds();
  return(s);
}

Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.