我看不到Joda认为这是有效日期。例:
strict = org.joda.time.format.DateTimeFormat.forPattern("MM/dd/yyyy")try { strict.parseDateTime('40/40/4353') assert false} catch (org.joda.time.IllegalFieldValueException e) { assert 'Cannot parse "40/40/4353": Value 40 for monthOfYear must be in the range [1,12]' == e.message}作为最好的,我可以告诉大家,同样没有日期格式与setLenient(假)。例:
try { df = new java.text.SimpleDateFormat('MM/dd/yyyy') df.setLenient(false) df.parse('40/40/4353') assert false} catch (java.text.ParseException e) { assert e.message =~ 'Unparseable'}希望这可以帮助!



