I am looking to check if the date I set is valid or not. This is how I have attempted to do it:
public boolean validDate() {
return calendar.isLenient();
}
Calling it like this:
Date date = new Date(36, 04, 2014);
System.out.println("Day = " + date.getDay());
System.out.println("Month = " + date.getMonth());
System.out.println("Year = " + date.getYear());
System.out.println("Is valid? = " + date.validDate());
System.out.println("Last day? = " + date.LastDayOfMonth(02));
And it returns this -
Day = 36
Month = 4
Year = 2014
Is valid? = true
Last day? = false
My question is why does it say it is valid even though it is not. Also how would I check to see if it is a false date or not?