title: How to convert Java TimeStamp into ms access Date?
body: <p>I would like to insert a java Timestamp into an msaccess database but I am getting an error which is listed below. The ms-access field has been set to a DATE datatype. Any advise would be deeply appreciated. Thanks</p>
  
  <p>Here's my DAO class method:</p>
  
  <pre><code>public void addSale(String saleDetails, String saleTotal, Timestamp saleTimestamp) 
                      throws ClassNotFoundException, SQLException {
  
  Statement myStatement = getConnection();
  String sql = "INSERT INTO Sale (SaleDetails, SaleTotal, SaleTimestamp)"
              + " VALUES ('"+saleDetails+"','"+saleTotal+"','"+saleTimestamp+"')";
  
  myStatement.executeUpdate(sql);
  closeConnection();
  </code></pre>
  
  <p>My DTO method:</p>
  
  <pre><code>public void storeSale(String saleDetails, String saleTotal, Timestamp saleTimestamp){
     DAO dao = DAO.getDAO();
     try {
        dao.addSale(saleDetails, saleTotal, saleTimestamp);
      } catch (ClassNotFoundException | SQLException ex) {
          Logger.getLogger(Sale.class.getName()).log(Level.SEVERE, null, ex);
      }
  </code></pre>
  
  <p>My Timestamp method:</p>
  
  <pre><code>public Timestamp addTimestamp(){ 
      java.util.Date date= new java.util.Date();
  return new Timestamp(date.getTime());
  }
  </code></pre>
  
  <p>Error:
      [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.</p>