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)