private static ValidDateSplit isDateValid ( String day , String month , String year ) { try { int dayInt = Integer . parseInt ( day ) ; int monthInt = Integer . parseInt ( month ) ; int yearInt = Integer . parseInt ( year ) ; if ( dayInt <= 0 || dayInt > 31 || monthInt <= 0 || monthInt > 12 || yearInt <= 0 || ( yearInt >= 100 && ( yearInt < 1900 || yearInt > 2019 ) ) ) { return null ; } return new ValidDateSplit ( dayInt , monthInt , yearInt ) ; } catch ( NumberFormatException e ) { return null ; } }
Verify that a date is valid . Year must be two digit or four digit and between 1900 and 2029 .