title: Convert string to Date in java
body: <p>I'm trying to parse a string to a date field in an android application but I can't seem to get it correct. Here is the string I'm trying to convert to a date "03/26/2012 11:49:00 AM". The function I'm using is:</p>
  
  <pre><code>private Date ConvertToDate(String dateString){
      SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
      Date convertedDate = new Date();
      try {
          convertedDate = dateFormat.parse(dateString);
      } catch (ParseException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      return convertedDate;
  }
  </code></pre>
  
  <p>But I keep getting <code>3/1/112 11:49AM</code> as the result.</p>