title: Conversion of string with AM/PM date-time, from Oracle database
body: <p>I have the timestamp in form of <code>03-AUG-12 08.15.00.000000000 PM -05:00</code>
  I am unable to get a <code>String</code> representation in form on <code>yyyy-MM-dd HH:mm:ss</code>. </p>
  
  <p>Here is my code :</p>
  
  <pre class="lang-java prettyprint-override"><code>public static void convert() {
  
      String oldstring = "03-AUG-12 08.15.00.000000000 PM -05:00";
      Date date = null;
      try {
          date = new SimpleDateFormat("dd-MMM-yy HH.mm.ss.S aa").parse(oldstring);
      }
      catch (ParseException e) {
          e.printStackTrace();
      }
  
      String newstring = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
      System.out.println(newstring);
  }
  </code></pre>
  
  <p>Basically it is a timestamp with timezone format from the Oracle database. </p>