actually you can do it quite easily. java.text.DateFormat.parse(String source) will throw a java.text.ParseException if the string cannot be parsed into a valid java.util.Date Object (DateFormat is an ancestor of SimpleDateFormat).
Therefore, the Exception you're catching can have 2 meanings:
1) the string is not a valid date
2) the string is not a date at all
You'd have to add some more logic to determine which of the two is the case (like trying to create integers from the parts of the string that should contain numbers, if that fails you're into case 2).
|