JS processing the date of some collation (JS gets the date the day before the given date)

Source: Internet
Author: User

var New date (), alert (date),//Get current time
Alert (Date.getfullyear ());//get Current year score
Alert (Date.getmonth ());//Get month (get the current month plus 1)
Alert (Date.getdate ());//Gets the number of the current date
Alert (Date.getday ());//Gets the current day of the week
Alert (Date.gettime ());//Get the millisecond from 1970/01/01 to the present
SetTime () adds milliseconds to 1970/01/01 08:00:00 and displays the new date and time.
varNew Date ();
Date.settime (24*1000*60*60);d ocument.write (date),//Output Thu Jan, 1970 08:00:00 gmt+0800 (China Standard Time)
//Get the date after the specified date D is that day, I is a few days later
function Gettomorrow (d, i) {varDate =NewDate (d); varTomorrow_milliseconds = Date.gettime () + +* -* -* -*i; vartomorrow=NewDate (); Tomorrow.settime (Tomorrow_milliseconds); varStryear =tomorrow.getfullyear (); varStrday =tomorrow.getdate (); varStrmonth = Tomorrow.getmonth () +1; if(Strmonth <Ten) {Strmonth="0"+Strmonth; } datastr= Stryear +"/"+ Strmonth +"/"+Strday; returnDATASTR; }
Gets the number of days before the given date I negative number can be

JS processing the date of some collation (JS gets the date the day before the given date)

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.