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();
d.setMilliseconds(192);
var n = d.getMilliseconds();
nOutput:
Try it yourself »
Definition and Usage
The setMilliseconds() method is used to set the milliseconds field of the specified time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the setMilliseconds() method
Syntax
Date.setMilliseconds(millisec)
Parameter Values
| Parameter | Description |
|---|---|
| millisec | Required. Used to set the milliseconds field of the dateObject. This parameter is an integer between 0 and 999:
|
Return Value
| Type | Description |
|---|---|
| Number | The millisecond representation from midnight January 1, 1970 to the adjusted date. |
Technical Details
| JavaScript Version: | 1.3 |
|---|
Other Extensions
JavaScript Date Object