JS Acquisition System designated date

Source: Internet
Author: User

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

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.