The date in JavaScript

Source: Internet
Author: User


Date class is used to process dates and times based on the number of milliseconds (timestamp) since January 1, 1970 (World Standard Time)


1. Create Date Object

var now = new Date ();//Current time var date = new Date (1000);//As of January 1, 1970 the second time var date = new Date (year,month,day,hour,minute,sec Ond,millisecond);//Create a Date object by specifying each time component separately


2, the method provided

GetTime () Gets the timestamp on which a Date object is based

A series of getter/setter methods are also provided to manipulate the various time components, such as gethours ()

Note: The return value in addition to GetMonth () (Get month) is starting at 0 and the rest is starting from 1


Example

<! doctype html public  "-//w3c//dtd html 4.01 transitional//en"   "HTTP// Www.w3.org/TR/html4/loose.dtd ">

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/9D/wKiom1fFWTjBe_jyAAJrgPdBk38976.gif "title=" Date.gif "alt=" Wkiom1ffwtjbe_jyaajrgpdbk38976.gif "/>







The date in 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.