code: public boolean compareDate(Date date1, Date date2) {
          if (date1 == null || date2 == null) {
              return false;
          }
          
          boolean result;
          GregorianCalendar cal1 = new GregorianCalendar();
          GregorianCalendar cal2 = new GregorianCalendar();
          cal1.setTime(date1);
          cal2.setTime(date2);
          
          if (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) &&
              cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) &&
              cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE)) {
              result = true;
          } else {
              result = false;
          }
          
          return result;
      }
docs: Compare one date to another for equality in year, month and date. Note
  that this ignores all other values including the time.  If either value
  is <code>null</code>, including if both are <code>null</code>, then
  <code>false</code> is returned.
  
  @param date1 The first date to compare.
  @param date2 The second date to compare.
  
  @return <code>true</code> if both dates have the same year/month/date,
  <code>false</code> if not.