Right now, I have a method that checks that the start date is before the end date. How would I make sure that the start is a minimum of 30 days before the end date?
The code looks like this:
public static boolean CheckDates(String start_date, String end_date) {
SimpleDateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd");
boolean b = false;
try {
if (dfDate.parse(start_date).before(dfDate.parse(end_date))) {
b = true; // If start date is before end date.
} else if (dfDate.parse(start_date).equals(dfDate.parse(end_date))) {
b = false; // If two dates are equal.
} else {
b = false; // If start date is after the end date.
}
} catch (ParseException e) {
e.printStackTrace();
}
return b;
}