Setmilliseconds functions in JavaScript

Source: Internet
Author: User

The Setmilliseconds function method in JavaScript is to set the millisecond value in the Date object expressed in local time. How to use:

Dateobj.setmilliseconds (NumMilli)

Where Dateobj is a required option. Any Date object.

Nummilli is a mandatory option. is a number equal to the millisecond value.

To set the millisecond value in global standard Time (UTC), use the setUTCMilliseconds method. If the value of NumMilli is greater than 999 or negative, the number of seconds saved (as well as minutes, hours, and so on, if needed) will increase the appropriate number.

The following example illustrates the use of the Setmilliseconds function method in javascript:

function Setmsecdemo (nmsec) {

var d, S; Declares a variable. Www.82676666.com

var Sep = ":"; Initializes the delimiter.

D = new Date (); Creates a Date object.

D.setmilliseconds (NMSEC); Sets the number of milliseconds.

s = "current setting is";

s + = d.tolocalestring () + Sep + d.getmilliseconds ();

return (s); Returns the new date setting.

}

Setmilliseconds functions in JavaScript

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.