Hi is there a way to check if an input is a date in Java, the date format is DD/MM/YYYY
so int\int\int
I have the basic check if (x != "")
but I was wondering if you check that it is a date.
Now I'me getting a new error code:
try {
date = (Date) dateFormat.parse(dateInput);
} catch (ParseException e1) {
System.out.println("FAIL!!!!!!!!");
JOptionPane.showMessageDialog(null, "Date entered is incorrect, please close this window and try again");
new BookApp();
}
The indents probably got messed in when I copied and pasted it, but when the format is wrong it works and the dialog menu pops up. But when I give 12\08\2015
it give a ClassCastError
.
How do I get this working?