title: Insert date in oracle using prepared statemnt
body: <p>My user interface returns a date as String (01/06/2016 2:30 am)to controller  and I want to insert the into <strong>oracle 10 database</strong>  by changing it from string to date and format to <strong>(dd-MMM-yy hh:mm:ss a)</strong> where the field is date type. Below is What I tried but getting <code>Illegal Argument</code> exception .</p>
  
  <p>In controller I formatted to date and passed it to service layer through DTO</p>
  
  <p><strong>created : 01/06/2016 09:00 pm</strong></p>
  
  <pre><code>SimpleDateFormat fromUser = new SimpleDateFormat("MM/dd/yyyy hh:mm a");
  SimpleDateFormat myFormat = new SimpleDateFormat("dd-MMM-yy hh:mm:ss a");
  
  String reformattedStr = myFormat.format(fromUser.parse(created));
  System.out.println("reformattedStr is : " + reformattedStr); 
  </code></pre>
  
  <p>**reformattedStr 06-Jan-16 09:00:00 PM  </p>
  
  <pre><code>Date formateDate=myFormat.parse(reformattedStr);
  </code></pre>
  
  <p>In service through prepared statement i am trying to insert , the date and other fields.</p>
  
  <p>stmt.setTimestamp (8,new java.sql.Timestamp(news.getCreated().getTime()));</p>
  
  <p>Can anyone please suggest?</p>
  
  <p>Thanks for the help , I have updated the code, it might help some one.</p>