views:

146

answers:

1

Hi all.

I am using org.apache.commons.validator.routines.DateValidator to validate a date with a simple date pattern "dd/mm/yyyy"

Unfortunate part is that if I pass a date in format "2/2/1992" then it declares it as an invalid date and if I use format "d/m/yyyy" (In java SimpleDateFormat both these formats works for both cases), then date "02/02/1992" is invalid.

am I missing something. Cannot change the code to use Simple date formater due to some restriction.

Any ideas will be appreciated. Thanks.

+1  A: 

You have to use non strict validation.. so do something like this.. DateValidator.isValid(date,format,'FALSE');

Pratik