title: How to match system date with the date from database mysql
body: <p>I have a database named work created using mysql in which a table named register is created. It contain a column renewdate. I accessed the table from java swing like this</p>
  
  <pre><code>    conn=ConnectionDB.conn();
      Date d=sysdate();
      String sql="select renewdate from register";
      try
      {
          ps=conn.prepareStatement(sql);
          ResultSet rs=ps.executeQuery();
          Date dates;
          while(rs.next())
          {
              dates = rs.getDate("renewdate");
              System.out.println(dates);
              if(dates==d)
              {
                 SendMailTLS.sendMail();
              }
          }
      }
  </code></pre>
  
  <p>My problem is to send an email when renewdate equals system date. I generate current date using function sysdate() and assigned it to d. Also assigned renewdate in table to dates using dates = rs.getDate("renewdate"). 
  My problem is I can not match up both d and dates and thus can not sent email. Could you help me how to match d and dates. 
  I tried while(rs.next()) all the dates from table register is obtained. But can not match with d using if(dates==d). Also I tried if(rs.next()), but it only fetch first renewdate from table. So how could i check all the values of renewdate and match with the current date to sent message</p>