Java tutorial
//package com.java2s; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getNextDateByMonth(String s, int i) { SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyyMMdd"); java.util.Date date = simpledateformat.parse(s, new ParsePosition(0)); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(2, i); date = calendar.getTime(); s = simpledateformat.format(date); return s; } }