The simplest solution would be to parse java.util.Date to java.time.LocalDate then you have a standard yyyy-mm-dd. this should be easy to validate. Can you identify the source of your date object? If you can obtain a calendar object fro you source or from the date object then this method I wrote should help with the parsing.
/**
* Utility method that parses java.util.Date to java 8's java.time.LocalDat
* <p>
* TODO finish method design
*
* @param calendarObj
* @return
*/
public static LocalDate parseCalendarToLocalDate(Calendar calendarObj) {
int month = calendarObj.get(Calendar.MONTH);
int year = calendarObj.get(Calendar.YEAR);
int day = calendarObj.get(Calendar.DAY_OF_MONTH);
LocalDate localDateObj = LocalDate.of(year,(month+1),day);
return localDateObj;
}
solved Validating string date without using java.util.Date class in Java [closed]