java.util.date 开发者_运维技巧= org.apache.commons.lang.time.DateUtils.parseDate(value, new String[] { "mm/dd/yyyy" });
If you give an invalid date string (e.g. value = 13/02/2000 or value = "12/35/2000"), this didn't result in an error (e.g. 13 as a month is invalid and 35 as a date is invalid). But the above function just moved the appropriate date | month bits and gave a date which was correct. Is there a function which will throw a ParseException in such cases?
DateUtils.parseDateStrictly(String, String[])
FTW!
精彩评论