Describes how to use the setSeconds () method in JavaScript.

Source: Internet
Author: User

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:

  • NA

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.