Trying this in the title environment:
http://www.javadb.com/check-if-a-string-is-a-valid-date
However, it isn’t working in the right way. When dateFormat.parse(inDate.trim()); is called, it doesn’t throws an error, instead it makes a plus one to the date.
For example, if inDate.trim() is "2005-02-29", then it makes the parsing like "2005-03-01".
Obviously, I won’t this behavior. What can be done?
Set the
setLenient()method on theSimpleDateFormatto false to throw errors in such cases: