javaparsingdate

SimpleDateFormat parsing and ambigious date formats


I'm trying to reject the parsing (through SimpleDateFormat::parse) of "18:00" from the date format HH. Is there an way to get this to happen without extra code? Does the date format accept $/regular expressions? I've enabled setLenient to false, and 18:00 still passes through the HH date format.

I realize I can make other comparisons to the string being parsed, but I'm looking for a way of doing this in the DateFormat string.


Solution

  • No, SDF doesn't allow "rules". It just parses and formats dates according to a pattern, and not a regex-type pattern, either, so no regexes.