JavaScript setUTCMilliseconds()Method
Example
Set the specified milliseconds to 192 according to Universal Time (UTC):
var d = new Date();
d.setUTCMilliseconds(192);
var n = d.getUTCMilliseconds();
d.setUTCMilliseconds(192);
var n = d.getUTCMilliseconds();
nOutput:
Try it Yourself »
Definition and Usage
The setUTCMilliseconds() method is used to set the milliseconds of a specified time according to Universal Time (UTC).
Tip:Coordinated Universal Time, also known as World Unified Time, World Standard Time, International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).
Tip:UTC time is the same as GMT (Greenwich) time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the setUTCMilliseconds() method.
Syntax
Date.setUTCMilliseconds(millisec)
Parameter Values
| Parameter | Description |
|---|---|
| millisec | Required. The value of the milliseconds field to be set for the dateObject. Expressed in Universal Time. This parameter is an integer between 0 and 999:
|
Return Value
| Type | Description |
|---|---|
| Number | Returns the number of milliseconds between midnight on January 1, 1970 and the time with the specified milliseconds set. |
Technical Details
| JavaScript Version: | 1.3 |
|---|
Other Extensions
JavaScript Date Object