Two-digit year in SimpleDateFormat
问题 Maybe this question is fool, but I didn't have found any answer that has satisfied me. I have a SimpleDataFormat like: sdf = new SimpleDateFormat("dd/MM/yyyy"); And if I try to parse a date like: 10/10/15 Then the Date result is for year 15, and not 2015. Why the parse works in this case? I was expecting a ParseException How I force the user to put year in 4 digit format? (Without String.length() please) I'm using setLenient(false) 回答1: Your date is interpreted literally. Per http://docs