Here you can find the source of getNextMonth()
public static Date getNextMonth()
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date getNextMonth() { String pattern = "yyyy-MM-dd"; Calendar cd = Calendar.getInstance(); cd.add(Calendar.MONTH, 1); String newTime = String.valueOf(cd.get(Calendar.YEAR)) + "-" + String.valueOf(cd.get(Calendar.MONTH) + 1) + "-" + String.valueOf(cd.get(Calendar.DAY_OF_MONTH)); return convertStringToDate(newTime, pattern); }//from w w w .ja v a 2s.c o m public static Date convertStringToDate(String dateStr, String pattern) { SimpleDateFormat format = new SimpleDateFormat(pattern); try { return format.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); return null; } } }