title: using the date type in java
body: <p>I am trying to get two dates from a SQL query, and compare them.  So to compare them, I believe I will need to use the "Date" type.   Here is what I am trying, I know I am getting the date from the resultSet incorrectly, but I am not sure how to do it.</p>
  
  <pre><code>Date validDate = new Date(0);
  Date currentDate = new Date(0);
  
  // query
  
      if (result.next()) {
  
      validDate  = (result.getObject("validDate")!=null)?result.getObject("validDate").toDate():"";
      currentDate = (result.getObject("currentDate")!=null)?result.getObject("currentDate").toDate():"";
  }
  
  if (currentDate &gt; validDate) {
      //do something
  }
  </code></pre>
  
  <p>So again, this was my attempt, but I cant seem to get it to run.  Thanks in advance.</p>
  
  <p>EDIT:   the query has TO_CHAR(<em>column</em>, 'MM-DD-YYYY') on the two dates that I am getting.</p>