title: How to truncate time on java.sql.Date?
body: <p>I have the following code:</p>
  
  <pre><code>String dateCompleted = "4/24/2009 2:38:44 PM";
  DateFormat format = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");
  java.util.Date tempDate = format.parse(dateCompleted);
  java.sql.Date completionDate = new java.sql.Date(tempDate.getTime());
  </code></pre>
  
  <p>I want to compare <code>completionDate</code> to a DATE value in an Oracle database table that does not include time. For example, I want to compare it to the value '4/24/2009' and have it return true, because these dates are the same.</p>
  
  <p>How do I truncate the time value from my variable in order to compare it to the database value? Thanks in advance!</p>