title: Java String to Date object of the format "yyyy-mm-dd HH:mm:ss"
body: <p>I need to convert a String containing date into an date object. The String will be of the format "yyyy-mm-dd HH:mm:ss.SSSSSS" and I want the same format in an date object.</p>
  
  <p>For instance I have a string "2012-07-10 14:58:00.000000", and I need the resultant date object to be of the same format.</p>
  
  <p>I have tried the below methods but, the resultant is not as expected. </p>
  
  <pre><code>java.util.Date temp = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss.SSSSSS").parse("2012-07-10 14:58:00.000000");
  
  DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
                  Date thisDate = dateFormat.parse("2012-07-10 14:58:00.000000");
  </code></pre>
  
  <p>The result is "Tue Jan 10 14:58:00 EST 2012". Please let me know where I am going wrong.</p>
  
  <p>Thanks,
  Yeshwanth Kota</p>