Date.setSeconds() (Method)

Sets the seconds value of the time object.


ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise Server - 2.0
Opera - 3.0
Property/method value type:Time value
JavaScript syntax:-myDate.setSeconds(aSecondsValue)
- ( JavaScript 1.3 +)myDate.setSeconds(aSecondsValue, aMillisecondsValue)
Argument list:aMillisecondsValueAn optional value between 0 and 999 milliseconds
aSecondsValueA value between 0 and 59 seconds

The values are computed as local time coordinates.

ECMA mandates that the milliseconds value should be an optional argument. If the milliseconds value is omitted, the current milliseconds value is used as if the value had been supplied with a getMilliseconds() method.

The result of this method is the new time value of the containing object having been adjusted by the values passed in as arguments.

Example code:

   myDate = new Date();
   myTime = myDate.getTime();
   document.write("The time rounded down to the nearest minute is "  + myTime + " Milliseconds");

See also:Date.getSeconds(), Date.prototype, Date.setUTCSeconds()


ECMA 262 edition 2 - section -

ECMA 262 edition 3 - section -