1 /**2 * Get system Current time3 */4 functionGetnowyearmouth () {5 varDate=NewDate;6 varNowyearmouth=date.getmonth (+1);7 varYear=date.getfullyear ();8 varDay =date.getdate ();9Nowyearmouth = (nowyearmouth<10? "0" +nowyearmouth:nowyearmouth);//get the current time----monthTen varNowyearmouthcur = (year.tostring () + "-" +nowyearmouth.tostring ());//get current time----month One varbeforsixyearmouthday=Getbeforeyearmouthday (); A returnnowyearmouthcur; - } - the /** - * Get system Current Month day - */ - functionGetnowyearmouthday () { + varDate=NewDate; - varNowyearmouth=date.getmonth (+1); + varYear=date.getfullyear (); A varDay =date.getdate (); atNowyearmouth = (nowyearmouth<10? "0" +nowyearmouth:nowyearmouth);//get the current time----month -Day= (day<10? ") 0 "+day:day); - varNowyearmouthday = (year.tostring () + "-" +nowyearmouth.tostring () + "-" +day.tostring ());//get the system current month day - returnNowyearmouthday; - } - in - to /** + * Six months before the system is acquired-- month and year - */ the functionGetbeforeyearmouth () { * varDate=NewDate; $ //date = new Date (date-86400000 *);Panax Notoginseng varMonth=date.getmonth (+1); - varYear=date.getfullyear (); the for(vari=0;i<6;i++) + { A if(month<=0) the { +month = month+12; -year--; $ } $ varTempmonth = (month<10? "0" +month:month); - varMyDate = year.tostring () + "-" +tempmonth.tostring (); -month--; the } - returnmydate;Wuyi } the /** - * Date of the first six months of acquiring the system Wu */ - functionGetbeforeyearmouthday () { About varTempmonth; $ varDate=NewDate; - varMonth=date.getmonth (+1); - varYear=date.getfullyear (); - varDay =date.getdate (); A for(vari=0;i<=12;i++){ + if(month<=0) { themonth = month+12; -year--; $ } theTempmonth = (month<10? "0" +month:month); themonth--; the } the if((year%100!=0) & (year%400==0) && (year%4==0)) {//is the case of a leap year - if(tempmonth==2) {//If it is February in if(day>29){ theTempmonth = tempmonth+1; the}Else{ AboutTempmonth =Tempmonth; the } the}Else{//It's not a February situation. theTempmonth =Tempmonth; + } -}Else{//not in the case of a leap year the if(tempmonth==2) {//If it is FebruaryBayi if(day>28){ theTempmonth = tempmonth+1; the}Else{ -Tempmonth =Tempmonth; - } the}Else{//It's not a February situation. theTempmonth =Tempmonth; the } the } - if(day<10){ theday= "0" +Day ; the } the varBeforeyearmouthday = year.tostring () + "-" +tempmonth.tostring () + "-" +day.tostring (); 94 returnBeforeyearmouthday; the}
JS Acquisition System designated date