The Date object for JavaScript

Source: Internet
Author: User
Tags time and date

I. Overview of Date objects

  1. JavaScript provides a date type to handle time and date. The Date object contains a series of methods to get and set date-time information.

2. The Date type in JavaScript was built on the basis of the Java.util.Date class in early Java.

3, the date type uses UTC (coordinated Universal time, international coordination times [also known as World Unification Time]) January 1, 1970 midnight (0 O'Clock) to start the milliseconds to save the dates.

4. In the case of this data storage format, the date type can be saved in exactly 285,616 years before or after January 1, 1970.

Second, create a Date object

Create a Date object, using the new operator and the date construction method (constructor).

var New // returns the system current time format when creating a Date object without passing parameters   : Thu Mar 20:18:08 gmt+0800 different  browsers show different alert (box); // new can be omitted var time = Date (), alert (time);

The Date object for JavaScript

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.