Here you can find the source of getNextYearMonth(String yearMonth)
public static String getNextYearMonth(String yearMonth)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static final String year_month_pattern = "yyyy-MM"; public static String getNextYearMonth(String yearMonth) { SimpleDateFormat format = new SimpleDateFormat(year_month_pattern); Calendar calendar = Calendar.getInstance(); try {/*from w w w . j a v a 2 s . com*/ calendar.setTime(format.parse(yearMonth)); } catch (ParseException e) { e.printStackTrace(); } calendar.add(Calendar.MONTH, 1); return format.format(calendar.getTime()); } }