JavaScript setMilliseconds() Method
Example
Set the milliseconds field of the specified time to 192:
var d = new Date();
d.setMilliseconds(192);
var n = d.getMilliseconds();
n Output result:
Try it »
Definition and Usage
The setMilliseconds() method is used to set the milliseconds field of a specified time.
Browser support





All major browsers support the setMilliseconds() method.
Syntax
Date
.setMilliseconds(
millisec
)
Parameter value
| Parameters | Description |
|---|---|
| millisec | Required. Used to set the milliseconds field of dateObject.
This parameter is an integer between 0 and 999: |
Return Value
| Type | Description |
|---|---|
| Number | Milliseconds from midnight on January 1, 1970 to the adjusted date. |
Technical Details
| JavaScript version: | 1.3 |
|---|
JavaScript Date object