Here you can find the source of getNextiMonth(Date date, int month)
public static String getNextiMonth(Date date, int month)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getNextiMonth(Date date, int month) { Calendar c = Calendar.getInstance(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); c.setTime(new Date()); c.add(Calendar.DATE, month); Date d2 = c.getTime();/* w ww. j a v a 2 s . co m*/ String s = df.format(d2); return s; } public static String getTime() { Calendar calendar = Calendar.getInstance(); String strHour = "" + calendar.get(Calendar.HOUR_OF_DAY); if (strHour.length() == 1) strHour = "0" + strHour; String strMinute = "" + calendar.get(Calendar.MINUTE); if (strMinute.length() == 1) strMinute = "0" + strMinute; String strSecond = "" + calendar.get(Calendar.SECOND); if (strSecond.length() == 1) strSecond = "0" + strSecond; String curTime = strHour + strMinute + strSecond; return curTime; } }