datetime - Is there a good *strict* date parser for Java? -


Is Java a good, hard date parser for? I have access to add-on time but I have yet to see this option. I got the question "a good date parser for java", and when it is related, then it is the opposite type, whereas this question was asking for a generous, more fuzzy logic and human error was parser, I Would like a hard parser. For example, if you have the format "MM / dd / yyyy" with both the addtime (as far as I can tell) and the simpler format format:

Parse it: 40/40/4353

It becomes a valid date. I need a parser who knows that 40 is an invalid month and date. Certainly Java has some implementation in this?

I do not know that as a valid date. Example: Try

  hard = org.joda.time.format.DateTimeFormat.forParttern ("MM / dd / yyyy") {strict. ParseDateTime ('40 / 40/4353 ') false role} hold (org.joda.time.IllegalFieldValueException e) {can not parse "40/40/4353": value for the month 40 years [1,12] Should be in '== E Message)  



As best I can say, neither does the example:

  try { Df = new java.text.SimpleDateFormat ('MM / dd / yyyy') df.setLenient (false) df.parse ('40 / 40/4353 ') Asserts false false (java.text.ParseException e) {Emphasis e.message = ~ 'unsecure'}  

Hope this helps!


Comments