2

I'm using date format object:

SimpleDateFormat dateFormatSearch = SimpleDateFormat("dd-MMM-yyyy HH:mm", Locale.getDefault());

And try to parse a string:

Date dateForm = dateFormatSearch.parse("29-Oct-2018 00:01");

It shows me the following error:

java.text.ParseException: Unparseable date: "29-Oct-2018 00:01"

Can anybody help? It seems to me I've got good pattern for such string.

Nazarii Moshenskiy
  • 1,271
  • 2
  • 11
  • 30
  • 6
    Is your default `Locale` able to read `Oct` as a month abreviation ? – Arnaud Nov 29 '18 at 16:21
  • I recommend you avoid the `SimpleDateFormat` class. It is not only long outdated, it is also notoriously troublesome. Today we have so much better in [`java.time`, the modern Java date and time API](https://docs.oracle.com/javase/tutorial/datetime/). – Ole V.V. Nov 30 '18 at 09:29

0 Answers0