I am attempting to use the Java 8 DateTimeFormatter class to parse a time string that is in Spanish. After several hours of searching, I cannot find any hints. The error being returned is:
java.time.format.DateTimeParseException: Text '905 PM AST MARTES 7 AGOSTO 2018' could not be parsed at index 4
This seem to be the start of the 'PM' element.
Here is the relevant code:
DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
builder.parseCaseInsensitive();
builder.appendPattern("hmm a z EEE d MMM yyyy");
DateTimeFormatter formatter = builder.toFormatter(new Locale("es", "PR"));
String spanishDate = "905 PM AST MARTES 7 AGOSTO 2018"
Instant issuanceInstant = Instant.from(formatter.parse(spanishDate));
I have tried formatting it differently, but this is a standard format used on meteorological messages that I need to parse. Any help would be greatly appreciated.