here's a small program which may help you:
import java.util.*;
public class DateDifference {
public static void main(String args[]){
DateDifference difference = new DateDifference();
}
DateDifference() {
Calendar cal1 = new GregorianCalendar();
Calendar cal2 = new GregorianCalendar();
cal1.set(2010, 12, 1);
cal2.set(2011, 9, 31);
System.out.println("Days= "+daysBetween(cal1.getTime(),cal2.getTime()));
}
public int daysBetween(Date d1, Date d2) {
return (int)( (d2.getTime() - d1.getTime()) / (1000 * 60 * 60 * 24));
}
}