public static boolean isDate ( String s ) { // Build a date formatter using the format specified by dateFormat DateFormat dateFormatter = new SimpleDateFormat ( dateFormat ) ; try { dateFormatter . parse ( s ) ; return true ; } catch ( ParseException e ) { // Exception noted so can be ignored. e = null ; return false ; } }
Check that a string is a date in the format specified by dateFormat .