Describes how to use the setSeconds () method in JavaScript.
The javascript Date. setSeconds () method specifies a Date based on the set seconds of the local time.
Syntax
1 |
Date. setSeconds (secondsValue [, msValue]) |
Note: Data inside and outside parentheses is optional.
The following is the detailed information about the parameters:
- SecondsValue: an integer between 0 and 59.
- MsValue: a number in milliseconds between 0 and 999.
If the msValue parameter is not specified, use the value returned by getMilliseconds from the method. If the specified parameter is out of the expected range, call setSeconds to update the latest information of the Date object accordingly. For example, if the value of secondsValue is 100, the minute (s) stored in the date object plus will be used in seconds.
Return Value:
Example:
1 2 3 4 5 6 7 8 9 10 11 12 |
<Html> <Head> <Title> JavaScript setSeconds Method </title> </Head> <Body> <Script type = "text/javascript"> Var dt = new Date ("Aug 28,200 8 23:30:00 "); Dt. setSeconds (80 ); Document. write (dt ); </Script> </Body> </Html> |
This produces the following results:
1 |
Thu Aug 28 23:31:20 UTC + 0530 2008 |