I want to calculate the difference between two dates. Currently, I am doing:
Calendar firstDate = Calendar.getInstance();
firstDate.set(Calendar.DATE, 15);
firstDate.set(Calendar.MONTH, 4);
firstDate.get(Calendar.YEAR);
int diff = (new Date().getTime - firstDate.getTime)/(1000 * 60 * 60 * 24)
This gives me output 0. But I want that I should get the output 0 when the new Date() is 15. Currently the new date is 14. It makes my further calculation wrong and I am confused how to resolve this. Please suggest.