Here you can find the source of getExactDiff(final Calendar cal1, final Calendar cal2)
public static final long getExactDiff(final Calendar cal1, final Calendar cal2)
//package com.java2s; import java.util.Calendar; public class Main { public static final long getExactDiff(final Calendar cal1, final Calendar cal2) { long diff = 0L; if (cal1.before(cal2)) { long start = cal1.getTimeInMillis(); long end = cal2.getTimeInMillis(); diff = end - start;//from w w w . ja v a2 s. c om diff = diff / (1000 * 60 * 60 * 24); } else if (cal1.after(cal2)) { diff = getExactDiff(cal2, cal1); diff *= -1; } return diff; } }