I'm stumped on this question. Is it possible to add dates before a specified date into an arraylist? No luck trying to find an answer.
This is how I intended to do it.
try {
String format = min;
String format2 = format.substring(0,7);
String format3 = format.substring(7,format.length());
String finalFormat =format2+"20"+format3;
String finalFormatPart1 = finalFormat.substring(0, 2);
String finalFormatPart2 = finalFormat.substring(3, 6);
String finalFormatPart3 = finalFormat.substring(7, finalFormat.length());
String finalFormatcomplete =finalFormatPart1+" "+finalFormatPart2+" "+finalFormatPart3;
minDate = new SimpleDateFormat("dd MMM yyyy").parse(finalFormatcomplete);
Log.i("minDateTime", minDate.toString());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Date rightNow = Calendar.getInstance().getTime();
for(int i=1; i != 31; i++) {
Calendar calendar = Calendar.getInstance();
calendar.add(rightNow, -i);
beforeMin.add(dateToAdd);
}
However, calendar.add() only accepts int, int. Is there a way to add dates before my specified date into an arraylist?