一个问题可能是您
Locale不是英语。试试这个:
DateFormat formatter = new SimpleDateFormat("dd-MMM", Locale.ENGLISH);try { System.out.println(formatter.parse("31-Dec"));} catch (ParseException e) { e.printStackTrace();}这为我返回:
1970年12月31日星期四00:00:00欧洲中部时间
由于日期字符串中缺少年份,因此您会看到它会自动插入
1970为年份。



