title: How to convert string Date to Timestamp in Java for the format dd-MMM-yyyy?
body: <p>I want to convert string Date to Timestamp in java. The following are the codes that I have written. The date value passed is in the format <em>19-SEP-2013</em>.</p>
  
  <pre><code>SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
  Date date = dateFormat.parse(tcmo.getCtsDate());
  ps.setTimestamp(ctr++, new Timestamp(date.getTime());
  </code></pre>
  
  <p>The variable <em>ctr</em> is declared already. <em>ps</em> is the <code>PreparedStatement</code> object. Later codes include <code>ps.executeUpdate()</code>. </p>
  
  <p><code>tcmo.getCtsDate()</code> returns the value 19-Sep-2013.</p>
  
  <p>Database can accept only Timestamp in the format <strong>2013-09-19 00:00:00.0</strong></p>
  
  <p>The exception thrown is <code>Unparseable Date "19-SEP-2013"</code>. can anyone help me to clear this?</p>