java.text.ParseException: Unparseable date: “01:19 PM”

This works:

  public static void main(String[] args) throws Exception {
   String s = "01:19 PM";
   Date time = null;
   DateFormat parseFormat = new SimpleDateFormat("hh:mm a", Locale.ENGLISH);
   System.out.println(time = parseFormat.parse(s));
  }

ouputs:

  Thu Jan 01 13:19:00 KST 1970

Leave a Comment