tags:

views:

151

answers:

1

How do I get a DateFormat of some sort to throw an exception if I try to parse an illegal date? If I parse a date like "99.99.9999" with a SimpleDateFormat with the pattern "dd.MM.yyyy", no exception is thrown, but this is clearly not a valid date.

+9  A: 

DateFormat.setLenient(false)

Joachim Sauer