title: getting the difference between date in days in java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3491679/how-to-calculate-difference-between-two-dates-using-java">how to calculate difference between two dates using java</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying something like this,
  where I'm trying to get the date from comboboxes  </p>
  
  <pre><code>Calendar start = Calendar.getInstance();
  Calendar end = Calendar.getInstance();  
  
  int Sdate=Integer.parseInt(cmbSdate.getSelectedItem().toString());  
  int Smonth=cmbSmonth.getSelectedIndex();
  int Syear=Integer.parseInt(cmbSyear.getSelectedItem().toString());  
  
  int Edate=Integer.parseInt(cmbEdate.getSelectedItem().toString());
  int Emonth=cmbEmonth.getSelectedIndex();
  int Eyear=Integer.parseInt(cmbEyear.getSelectedItem().toString());
  
  start.set(Syear,Smonth,Sdate);  
  end.set(Eyear,Emonth,Edate);
  
  DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  String startdate=dateFormat.format(start.getTime());  
  String enddate=dateFormat.format(end.getTime());
  </code></pre>
  
  <p>I'm not able to subtract the end and start date 
  How do I get the difference between the start date and end date??</p>