Javascript Date Type

Source: Internet
Author: User

The date type stores dates using the number of milliseconds that have elapsed since midnight UTC January 1, 1970. Create Date Object
var New Date (); // Get Current date
Date.parse () accepts a string parameter that represents a date, returning the corresponding number of milliseconds. This date format usually varies by region. In fact, the date string is passed directly to the dates constructor, and the background is called date.parse (), so the following two are equivalent
var New Date (Date.parse ("May, 2004")); var New Date ("May 25, 2004");

The DATE.UTC () parameters are the year, the month (0-11), the Day (1-31), The Hour (0-23), the minute, the second, and the number of milliseconds. Omitted parameters are automatically populated with 0 (days of 1) and the same UTC parameter can be passed directly to the date constructor
// May 5, 2005 PM 5:55:55 var New Date (DATE.UTC ("2005, 4, 5, N, N,")); var New Date ("2005, 4, 5, 17, 55, 55");
Date.now () returns the number of milliseconds in the current moment Methods of InheritanceThe date tolocalestring () returns the day and time (will contain AM or PM) but does not contain the time zone information ToString () returns the date time with the time zone information Chrome Firefox date.valeuof () will return a millisecond representation of the date, So the date size can be compared method of formattingThe last two results vary by browser, but toUTCString () is recommended. Date/Time component methodGet or set a specific value directly
Get/settime () get/set (UTC) Fullyear () get/set (UTC) Month () get/set (UTC) Date ()get (UTC) Day () Get/set (UTC) Hours () get/set (UTC) Minutes () get/set (UTC) Seconds () get/set (UTC) Milliseconds ()  getTimezoneOffset Returns the number of minutes between local and UTC time

Javascript Date Type

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.