L
laredotornado
Hi,
I'm using Java 1.6. I have this code for verifying that a date is in
the format "MM/dd/yyyy" ...
SimpleDateFormat sdf = new SimpleDateFormat
(DatePref.DATE_FORMAT);
sdf.setLenient(false);
Date d = sdf.parse((String) value, new ParsePosition(0));
if (d == null) {
LOGGER.error("Failed to parse:" + value);
return;
}
Problem is, if a non-existent date, e.g. "02/29/2011" is passed in, it
also fails parsing. So my question is, how can I distinguish between
a date that doesn't exist and a date that is not in the format I would
like?
Thanks, - Dave
I'm using Java 1.6. I have this code for verifying that a date is in
the format "MM/dd/yyyy" ...
SimpleDateFormat sdf = new SimpleDateFormat
(DatePref.DATE_FORMAT);
sdf.setLenient(false);
Date d = sdf.parse((String) value, new ParsePosition(0));
if (d == null) {
LOGGER.error("Failed to parse:" + value);
return;
}
Problem is, if a non-existent date, e.g. "02/29/2011" is passed in, it
also fails parsing. So my question is, how can I distinguish between
a date that doesn't exist and a date that is not in the format I would
like?
Thanks, - Dave