English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
setUTCSecondsThe () method sets the seconds (0 ~ 59)
If the specified parameter is out of the expected range, thensetUTCSeconds() willtry to update the date information in the Date object accordingly.
For example, if you set90 is used assecondsthe value, the minutes stored in the Date object will increase1and30 will be used for seconds.
This method can also be used to set milliseconds.
World Standard Time (UTC) is the standard time set for world time.
date.setUTCSeconds(seconds, millisec)
var d = new Date(); d.setUTCSeconds(24);Test and see‹/›
If not specifiedmillisec millisecondsParameter, from the value returned by the getUTCMilliseconds() method.
All browsers fully support the setUTCSeconds() method:
Method | |||||
setUTCSeconds() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
seconds | (Required) 0 to59The integer between the two, representing seconds |
millisec | (Optional) 0 to999The number between the two, representing milliseconds |
Return value: | 1970 years1Month1Milliseconds between the date 00:00:00 UTC and the update date |
---|---|
JavaScript version: | ECMAScript 1 |
Specify90 as seconds value:
var d = new Date(); d.setUTCSeconds(90);Test and see‹/›