1

I am running the following code:

DateFormat fullDate = new SimpleDateFormat("HHmmdd/MMMyy");
Date date = fullDate.parse("035627/NOV15");

and the following exception is thrown:

Exception in thread "main" java.text.ParseException: Unparseable date:"035627/NOV15

Any ideas, why the exception is thrown, while the format is validly stated?

1 Answer 1

5

The likeliest reason is that NOV is not a valid month in your default Locale. This should fix the problem (adjust the Locale to match the language used for the month name):

DateFormat fullDate = new SimpleDateFormat("HHmmdd/MMMyy", Locale.ENGLISH);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.