Easy Tutorial
❮ Jsref Find Jsref Regexp Unicode Hex ❯

JavaScript setUTCSeconds() Method

JavaScript Date Object

Example

Set the seconds field to 35 for the current time according to UTC:

d Output result:


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 (UTC), also known as Universal Time Coordinated, World Standard Time, and International Coordinated Time.

Note: UTC time is the same as GMT (Greenwich Mean Time).


Browser Support

All major browsers support the setUTCSeconds() method.


Syntax

Parameter Values

Parameter Description
sec Required. The value of the seconds field to be set for the dateObject. This is represented using UTC. The parameter is an integer between 0 and 59: -1 is the last second of the previous minute<br>60 is the first second of the next minute
millisec Optional. The value of the milliseconds field to be set for the dateObject. This is represented using UTC. The parameter is an integer between 0 and 999: -1 is the last millisecond of the previous second<br>1000 is the first millisecond of the next second

Return Value

Type Description
Number The milliseconds representation of the adjusted date.

Technical Details

| JavaScript Version: | 1.3 | | --- | --- |


More Examples

Example

Set both the seconds and milliseconds according to UTC:

n Output result:


JavaScript Date Object

❮ Jsref Find Jsref Regexp Unicode Hex ❯