title: Inserting custom date and current time into Oracle database using string variables
body: <p>So what I want to do is set a custom date along with the current time into the DATE type in the Oracle database.
  I get the string from textField in the form of mm/dd/yyyy</p>
  
  <pre><code> String tdate = textDate.getText().trim();
  </code></pre>
  
  <p>To simplify the details lets just insert the DATE into a small table.</p>
  
  <pre><code> Calendar calendar = Calendar.getInstance();                                
   int hour = calendar.get(Calendar.HOUR);
   int minute = calendar.get(Calendar.MINUTE);
   int second = calendar.get(Calendar.SECOND);
   String current_time = hour+":"+minute+":"+second;
  </code></pre>
  
  <p>now we have tdate as the string of date and current_time as the current time.</p>
  
  <p>to put into a database with table defined as :</p>
  
  <pre><code>create table transaction(
                tranaction_num integer,
                time_of_transaction DATE);
  </code></pre>
  
  <p>now in jdbc</p>
  
  <pre><code>PreparedStatement pStmt = Conn.prepareStatement("insert into transaction values(?,?));
  pStmt.setString(1, "1");
  pStmt.setString(2, "to_date( '"+tdate+" "+current_time+"','mm/dd/yyyy hh24:mi:ss')");
  pStmt.executeUpdate();
  </code></pre>
  
  <p>This gives me an error as below</p>
  
  <pre><code> ORA-01858: a non-numeric character was found where a numeric was expected
  </code></pre>
  
  <p>I know I am doing something wrong but I have tried so many things to get this working. I don't mind getting the current time some other way as long as it is working</p>
  
  <p>Any help would be appreciated</p>