JS Summary 2:date Object

Source: Internet
Author: User

The 1 Date object is used to process dates and times. Based on Google's latest standards, variables are created in the future with the Const keyword.

There are a lot of methods for Date (), and here are just a few ways to summarize the work required!

First, create a Date object: the const mydate=new date ();

<script type= "Text/javascript" >

Const mydate=new Date ();

Alert (Date ()); Returns a full date and time

Alert (mydate.gethours ());//return current hour
Alert (Mydate.getminutes ());//return current minute
Alert (Mydate.getseconds ());//Returns the current number of seconds

Alert (Mydate.getday ());//returns the current week
Alert (Mydate.getmonth ());//returns the current month
Alert (Mydate.getfullyear ());//returns the current year

</script>

JS Summary 2:date Object

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.