public static boolean isTime ( String s ) { // Build a time formatter using the format specified by timeFormat DateFormat dateFormatter = new SimpleDateFormat ( timeFormat ) ; 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 time in the format specified by timeFormat .