2011 , . . SimpleDateFormat Date. java.time:
String date = "14 aug 2011";
DateTimeFormatter parseFormatter = new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.appendPattern("dd MMM uuuu")
.toFormatter(Locale.ENGLISH);
System.out.println(LocalDate.parse(date, parseFormatter)
.format(DateTimeFormatter.BASIC_ISO_DATE));
:
20110814
, , , . , , A , , , . parseCaseInsensitive(). , appendPattern().
: "14aug" . SimpleDateFormat 1970 ( ), , . , :
String date = "14aug";
DateTimeFormatter parseFormatter = new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.appendPattern("ddMMM")
.parseDefaulting(ChronoField.YEAR, Year.now(ZoneId.systemDefault()).getValue())
.toFormatter(Locale.ENGLISH);
, , :
20170814
2: , DateTimeFormatter.BASIC_ISO_DATE , .