Date Arithmetic function. Adds the specified (signed) amount of time to the given time field, based on the calendar's rules. For example, to subtract 5 days from the current time of the calendar, you can achieve it by calling:
add(Calendar.DATE, -5).
add(Calendar.DATE, -5).
long date2=d2.getTime();
long days=(date1-date2)/(24*60*60*1000)