JavaScript Date and time

Source: Internet
Author: User
Tags time and date

The date () constructor that is used to create an object that represents the time and date.

  1. var then = newDate(2011, 0, 1); //January 1, 2011
  2. var later = newDate(2011, 0, 1, 17, 10, 30); //On the same day, local time 5:10:30pm is displayed
  3. var now = newDate(); //Current date and time
  4. var elapsed = Now-then; //Calculate the number of milliseconds for the time interval
  5. Later.getfullyear (); //
  6. Later.getmonth (); //0: Month starting from 0 count
  7. Later.getday (); //1: Number of days to count starting from 1
  8. Later.gethours (); //5: Get Day of the week, 0 for Sunday, 5 for Monday
  9. Later.getutchours (); //Use UTC to indicate hours, based on time zone

JavaScript Date and time

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.