setUTCMilliseconds()  Date   instance method JS Home  <<  JS Reference  <<  Date  <<  setUTCMilliseconds()

Description

Sets the UTC milliseconds (0-999) for the specified date.

Syntax

Signature Description
aDate.setUTCMilliseconds(millisecondsInt)Sets the UTC milliseconds (0-999) for the specified date.

Parameters

Parameter Description
millisecondsIntAn integer in the range 0-999.
  • For other values the setUTCMilliseconds() method will try and set the date accordingly.

Examples

The code below shows examples of the setUTCMilliseconds() method of Date.



// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);

// Set and display some dates.
todaysDate.setUTCMilliseconds(100000);
alert(todaysDate + ' - UTC milliseconds set to 100000');

todaysDate.setUTCMilliseconds(10000000000);
alert(todaysDate + ' - UTC milliseconds set to 10000000000');

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times