jquery get the current date of the previous month

// date, jquery obtain the month before the current date 
 var = new new latayesr a Date () the getFullYear () -. 1;.
 Var = new new currentYear a Date () the getFullYear ();.
 Var new new = the currentMonth a Date () The getMonth ();.
 dATE = currentYear + var '-' + the currentMonth;
 IF (== 0 the currentMonth) {
        currentYear =-currentYear. 1;
        dATE = currentYear + '-' + 12 is;
 }
 // date, jquery acquired before the end date of the current month

// block assignment to date
 $ ( "# date1") scroller ( 'setDate', new Date (date), true);. / * Input block assignment to date, the month before the current date value * /
 $ ( " # date2 ") scroller ( 'setDate ', new date (latayesr + ''), true);. / * to a second date input box assignment, the current value of the previous year * /

Guess you like

Origin blog.csdn.net/yijiupingfan0914/article/details/93741757