It was a sub-question in my last post, to which I didn't get the answer.. If the String represents the 31st of April, June, etc., the exception is not thrown, but everything else works fine (32nd of April or May for example throws an exception). What I am doing wrong?
public OrderDate(String date) throws IllegalDateFormatException
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/mm/yy");
try
{
dateFormat.setLenient(false);
dateFormat.parse(date);
this.date = date;
}
catch(ParseException e)
{
throw new IllegalDateFormatException("Date must have the following"
+ " format: dd/mm/yy");
}
}