JavaScript setUTCSeconds()Method
Example
Set the seconds field of the current time to 35 according to UTC:
d.setUTCSeconds(35);
dOutput:
Try it Yourself »
Definition and Usage
The setUTCSeconds() method is used to set the seconds field of a specified time according to UTC.
This method is applicable for setting the seconds field of a specified time.
Tip:Coordinated Universal Time, also known as Universal Time Coordinated, World Standard Time, International Coordinated Time, abbreviated as UTC.
Note:UTC time is the same as GMT (Greenwich) time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the setUTCSeconds() method.
Syntax
Parameter Values
| Parameter | Description |
|---|---|
| sec | Required. The value to set for the seconds field of the dateObject, expressed in UTC. This parameter is an integer between 0 and 59:
|
| millisec | Optional. The value to set for the milliseconds field of the dateObject, expressed in UTC. This parameter is an integer between 0 and 999:
|
Return Value
| Type | Description |
|---|---|
| Number | The millisecond representation of the adjusted date. |
Technical Details
| JavaScript Version: | 1.3 |
|---|
More Examples
Example
Set the seconds and milliseconds according to UTC:
d.setUTCSeconds(35,825);
var n=d.getUTCSeconds() + ":" + d.getUTCMilliseconds();
nOutput:
Try it Yourself »
Other Extensions
JavaScript Date Object