setMilliseconds()
Date
instance method
JS Home <<
JS Reference <<
Date <<
setMilliseconds()
Description
Sets the locale specific milliseconds (0-999) for the specified date.
Syntax
Signature | Description |
---|---|
aDate.setMilliseconds(millisecondsInt) | Sets the locale specific milliseconds (0-999) for the specified date. |
Parameters
Parameter | Description |
---|---|
millisecondsInt | An integer in the range 0-999.
|
Examples
The code below shows examples of the setMilliseconds()
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.setMilliseconds(100000);
alert(todaysDate + ' - milliseconds set to 100000');
todaysDate.setMilliseconds(10000000000);
alert(todaysDate + ' - milliseconds set to 10000000000');
Related Tutorials
JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times