title: Java Date Calculation
body: <p>I have a database field where date is stored as DD/MM/YYYY format. Now what I want to do is to see if today date = stored date - 1. Basically if today is the day before the end date. Based on that I will do some action...</p>
  
  <p>example of format:</p>
  
  <pre><code>10/02/2012
  </code></pre>
  
  <p>There is formatting issue here because am using this:</p>
  
  <pre><code>Date todayDate;
  </code></pre>
  
  <p>And the stored date is VARCHAR2 in DB. Am assuming I would have to convert the retrieved date to Date regular format, or something like that. Help would be appreciated.</p>
  
  <p>Update:</p>
  
  <pre><code>                currentEndDate =  rset.getString("ENDDATE");
                  endDate = (Date)formatter.parse(currentEndDate);
                  /*Check if end date = today date - 1*/
                  Calendar cal = Calendar.getInstance();
                  //set to end date
                  cal.setTime(endDate);
                  //end date - 1
                  cal.add(Calendar.DATE, -1); 
                  Date today;
  </code></pre>
  
  <p>Now this is what I have..I am trying here to get the end date -1 so I did that using add() function. Now How can I check if end-date - 1 == today date or not? because when I tried :</p>
  
  <pre><code>if(today.equals(cal.add(Calendar.date, -1)))
  </code></pre>
  
  <p>it said void return from the add function. 
  Thanks, </p>