使用“旧”,Java 8之前的版本
SimpleDateFormat
new java.text.SimpleDateFormat("MMM yyyy", new java.util.Locale("es", "ES")).parse("Mayo 2017")
Date
如何使用Java 8和
DateTimeFormatter
我试过:
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).withLocale(new Locale("es", "ES")).ofPattern("MMM yyyy").parse("Mayo 2017")
但只有一个
java.time.format.DateTimeParseException
.