Hu Bojun on JS Get the current Time method collection

Source: Internet
Author: User

var mydate = new Date ();
mydate.getyear (); get Current year (2 -bit )
mydate.getfullyear (); get the full year (4 -bit , 1970-????)
Mydate.getmonth (); get the current month (0-11,0 represents 1 months )
mydate.getdate (); get current day (1-31)
Mydate.getday (); get current Week X (0-6,0 for Sunday )
Mydate.gettime (); gets the current time ( The number of milliseconds starting from 1970.1.1 )
mydate.gethours (); gets the current number of hours (0-23)
mydate.getminutes (); gets the current number of minutes (0-59)
mydate.getseconds (); gets the current number of seconds (0-59)
mydate.getmilliseconds (); gets the current number of milliseconds (0-999)
mydate.tolocaledatestring (); get current date
var mytime=mydate.tolocaletimestring (); get current time
mydate.tolocalestring (); get date and time

Date Time Script Library Methods list

Date. Prototype.isleapyear Judging leap years
Date.prototype.Format date formatting
Date.prototype.DateAdd Date Calculation
Date.prototype.DateDiff Comparison date difference
Date.prototype.toString Date to string
Date.prototype.toArray date split into arrays
Date.prototype.DatePart Partial information of the date taken
Date.prototype.MaxDayOfDate The maximum of the month in which the date is taken days
Date.prototype.WeekNumOfYear The week of the year in which the date is judged
stringtodate string to date type
isvaliddate Verifying date validity
checkdatetime Full date and time check
daysbetween Date days difference


Welcome to watch my online Java full set of free teaching super Clear Video:

Http://v.youku.com/v_show/id_XODQ1NjU0NDc2.html This is one of the video connections, you can drag to the Youku video below, subscribe to my account, because later I will have more videos provided free of charge

Baidu Search: Enter the Fcs_d, or enter "Hu Bojun" can see a lot of my video

Or add my number: Fcsboy I can notify you in time.

QQ Learning Group: 237053693


Hu Bojun on JS Get the current Time method collection

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.