Availability: |
| ||||||||
Property/method value type: | Time value | ||||||||
JavaScript syntax: | - | myDate.setSeconds(aSecondsValue) | |||||||
- ( JavaScript 1.3 +) | myDate.setSeconds(aSecondsValue, aMillisecondsValue) | ||||||||
Argument list: | aMillisecondsValue | An optional value between 0 and 999 milliseconds | |||||||
aSecondsValue | A 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.
<HTML> <HEAD></HEAD> <BODY> <SCRIPT> myDate = new Date(); myDate.setMilliseconds(0); myDate.setSeconds(0); myTime = myDate.getTime(); document.write("The time rounded down to the nearest minute is " + myTime + " Milliseconds"); </SCRIPT> </BODY> </HTML>
See also: | Date.getSeconds(), Date.prototype, Date.setUTCSeconds() |
Prev | Home | Next |
Date.setMonth() | Up | Date.setTime() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |