JavaScript Date setUTCSeconds() Method
- Previous Page setUTCMonth()
- Next Page toDateString()
- Go Back to the Previous Level JavaScript Date Reference Manual
Definition and Usage
setUTCSeconds()
The method sets the seconds of the date object according to UTC time.
This method can also be used to set milliseconds.
Tip:Coordinated Universal Time (UTC) is the time set by the world time standard.
Note:UTC time is the same as GMT time (Greenwich Mean Time).
Instance
Example 1
Set the seconds to 35 according to UTC time:
var d = new Date(); d.setUTCSeconds(35);
Example 2
Set seconds and milliseconds according to UTC:
var d = new Date(); d.setUTCSeconds(35, 825); var n = d.getUTCSeconds() + ":" + d.getUTCMilliseconds();
Syntax
Date.setUTCSeconds(sec, millisec)
Parameter Value
Parameter | Description |
---|---|
sec |
Required. Represents the integer part of seconds. The expected value is 0-59, but other values are allowed:
|
millisec |
Optional. Represents the integer part of milliseconds. The expected value is 0-999, but other values are allowed:
|
Technical Details
Return Value: | A number representing the milliseconds between the date object and midnight on January 1, 1970. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
setUTCSeconds() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Date
Tutorial:JavaScript Date Format
Tutorial:JavaScript Date Setting Methods
- Previous Page setUTCMonth()
- Next Page toDateString()
- Go Back to the Previous Level JavaScript Date Reference Manual