js-Object Use

Source: Internet
Author: User

1. Date Object

Define a Time object:

Note : Use the first letter of the keyword New,date () to capitalize.

Makes udate a Date object and has an initial value: The current time (current computer system time).

2. Common methods of object date

Common methods for processing time and dates in a Date object:

3. Return to Week method

GetDay () returns a number of 0-6 in the week, 0 for Sunday. If you want to return the corresponding "week", complete with the array, the code is as follows:

<script type= "Text/javascript" >  var mydate=new Date ();  Define Date Object  var weekday=["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];  Defines the array object, assigns a value to each array item  var mynum=mydate.getday ();//The return value is stored in the variable mynum document.write (  Mydate.getday ()); //Output GetDay () get        

js-Object Use

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.