English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
call setSeconds()the seconds of the date object set by the method.
If the parameter you specify is outside the expected range (0 to59),thensetSeconds()try to update the date information in the Date object accordingly.
For example, if you set90 is used assecondsThe minutes stored in the Date object will increase if the value is set1,而30 will be used for the second value.
This method can also be used to set milliseconds.
date.setSeconds(seconds, millisec)
var d = new Date(); d.setSeconds(24);Test and see‹/›
If not specifiedmillisecIf the parameter is not specified, use the value returned by the getMilliseconds() method.
All browsers fully support the setSeconds() method:
Method | |||||
setSeconds() | 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 Year1Month1Milliseconds between 00:00:00 UTC and the update date |
---|---|
JavaScript Version: | ECMAScript 1 |
Specify90 as the second value:
var d = new Date(); d.setSeconds(90);Test and see‹/›