I'm programming a window where the user has to type a date on a input field but I don't know how to check if the day or month are coherent or not (like day between 1-31 and month between 1-12)
String string = "26/03/2017";
DateFormat format = new SimpleDateFormat("dd/MM/yyyy") ;
try {
Date date = format.parse(string);
} catch (ParseException e) {
e.printStackTrace();
}
This is the piece of code where I'm formatting the Date, but I have no idea to check what I said before.