Android examples for java.util:Day
get Date After Someday
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main{ public static String getDateAfterSomeday(String firstStart, int i) { Calendar c = Calendar.getInstance(); try {// w w w . j a v a2s . c om c.setTime(new SimpleDateFormat("yyyy-MM-dd").parse(firstStart)); } catch (ParseException e) { e.printStackTrace(); } long sTime = c.getTimeInMillis(); long addTime = i * 24 * 60 * 60 * 1000; long eTime = sTime + addTime; Date date = new Date(eTime); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(date); } }