Here you can find the source of daysBetween(Calendar fromDate, Calendar toDate)
public static long daysBetween(Calendar fromDate, Calendar toDate)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static long daysBetween(Calendar fromDate, Calendar toDate) { return Math.round((toDate.getTimeInMillis() - fromDate.getTimeInMillis()) / (1000 * 60 * 60 * 24)); }//from www. j a v a2 s .c o m public static long daysBetween(Date fromDate, Date toDate) { return daysBetween(getCalendar(fromDate), getCalendar(toDate)); } public static Calendar getCalendar(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar; } }