Stijn.V Stijn.V - 1 year ago 194
Android Question

java.text.ParseException: Unparseable date

I get the following error:
┬┤java.text.ParseException: Unparseable date: "Aug 31 09:53:19 2011"┬┤ with this format:

new SimpleDateFormat("MMM dd HH:mm:ss yyyy");

Does anyone see the problem?

Answer Source

Make sure you're using the correct locale. (The SimpleDateFormat(String) constructor uses the system default locale, which may not be the one you want to use.)

This works fine on my machine:

String input = "Aug 31 09:53:19 2011";
DateFormat df = new SimpleDateFormat("MMM dd HH:mm:ss yyyy", Locale.US);

(While using Locale.FRENCH for instance, results in a ParseException.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download