Here you can find the source of getWeekDays(String _date, int _amount)
public static String getWeekDays(String _date, int _amount)
//package com.java2s; import java.util.Calendar; public class Main { public static String getWeekDays(String _date, int _amount) { String res;/*from w ww . j a va 2s .c om*/ int year = Integer.parseInt(_date.substring(0, 4)); int month = Integer.parseInt(_date.substring(4, 6)); int day = Integer.parseInt(_date.substring(6, 8)); Calendar wCal = Calendar.getInstance(); wCal.set(year, month - 1, day); wCal.add(Calendar.DATE, _amount); year = wCal.get(Calendar.YEAR); month = wCal.get(Calendar.MONTH) + 1; day = wCal.get(Calendar.DATE); res = Integer.toString(year); if (month < 10) res += "0" + Integer.toString(month); else res += Integer.toString(month); if (day < 10) res += "0"; res += Integer.toString(day); return res; } }