Q:

Error while parsing a time string

I am trying to parse some time strings like this:
String time_string = "10:00 AM";
SimpleDateFormat format = new SimpleDateFormat("hh:mm a");
Date date = null;
try {
    date = format.parse(time_string);
    // Do something with 'date'
} catch (ParseException e) {
    Log.w("Time", e.toString());
}

But the parser is failing with the exception:
java.text. ParseException: Unparseable date: "10:00 AM"
What I am doing wrong? 

A:

The AM/PM marker may not match that of your default Locale Try
SimpleDateFormat format = new SimpleDateFormat("hh:mm a", Locale. ENGLISH);

