public static boolean isValidDate ( final String date , final String format , final boolean lenient ) { boolean isValid = true ; if ( date == null || format == null || format . length ( ) <= 0 ) { return false ; } try { final DateFormat df = new SimpleDateFormat ( format ) ; df . setLenient ( lenient ) ; df . parse ( date ) ; } catch ( final ParseException | IllegalArgumentException e ) { isValid = false ; } return isValid ; }
Checks if the Date is valid to convert .