1) Get the next month of the specified year.
/** * Get next month * * @date format is yyyymm date, such as: 201401 */ function getNextMonth(date) { var year = date.substring(0,4); //Get the year of the current date var month = date.substring(4,6); //Get the month of the current date // Months +1 var nextMon = parseInt(month) + 1; if(nextMon >= 13){ nextMon = "01"; year = parseInt(year)+1//year+1 }else if (nextMon < 10) { nextMon = "0" + nextMon; } var t2 = year + "" + nextMon; return t2; }