title: How to convert 24 hrs time to 12 hours format in java using the date from the database
body: <p>I just want to convert a date from the database to 12 hours format which is originally in 24 hours format which is something like this <code>2015-06-11T28:28:57.000Z</code>. In here this time format (<code>28:25:57</code>) seems to be the next day (ie. <code>2015-06-12T04:28:57</code>). </p>
  
  <p>I have tried with the following:</p>
  
  <pre><code>String date = "2015-06-11T28:28:57.000Z";
  SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss a");
  Date date = formatter.parse(date);
  </code></pre>
  
  <p>but I got an error like unparsable date.</p>