The related operation knowledge _javascript technique of date function in JavaScript

Source: Internet
Author: User
Tags timestamp to date

Time object is an object that we often want to use, whether it is to do time output, time judgment and other operations are inseparable from this object. In addition to the time objects in JavaScript, there are a lot of time objects in VBScript, and they are very useful. Follow our process to explain the date function in JavaScript.

New Date ()

New Date (milliseconds)

New Date (datestring)

New Date (year, month)

New Date (year, month, day)

New Date (year, month, day, hours)

New Date (year, month, day, hours, minutes)

New Date (year, month, day, hours, minutes, seconds)

New Date (year, month, day, hours, minutes, seconds, microseconds)

Under the face

1.new date (), when there are no parameters, the current time Date object is created.

2.new Date (milliseconds), when the parameter is a number, then this parameter is a timestamp, is treated as a millisecond, creating a time Date object that is specified in milliseconds from January 1, 1970.

3.new Date (datestring), this parameter is a string, and this string must be able to use Date.parse () conversion.

4. The following six constructors are precisely defined:

1. Year, is an integer, if it is 0-99, then add 1900 on this basis, the others are returned as is.

2). Month, is an integer, the range is 0-11.

3. Day, is an integer, the range is 1-31.

4). Hours, is an integer, the range is 0-23.

5). Minutes, is an integer, the range is 0-59.

6). Seconds, is an integer, the range is 0-59.

7. Microseconds is an integer, the range is 0-9999.

 

Related Article

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.