public static boolean isDateTime ( String s ) { DateFormat dateFormatter = new SimpleDateFormat ( dateTimeFormat ) ; try { dateFormatter . parse ( s ) ; return true ; } catch ( ParseException e ) { // Exception noted so can be ignored. e = null ; return false ; } }
Checks that a string is a datetime in the format specified by dateTimeFormat .