Priyank
Priyank

Reputation: 14387

Apache Date Validator Pattern Question

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.

Upvotes: 0

Views: 3733

Answers (1)

Pratik Garg
Pratik Garg

Reputation: 977

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

Upvotes: 1

Related Questions