Here you can find the source of differenceInDays(Calendar date1, Calendar date2)
public static long differenceInDays(Calendar date1, Calendar date2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static long differenceInDays(Calendar date1, Calendar date2) { final long msPerDay = 1000 * 60 * 60 * 24; final long date1Milliseconds = date1.getTime().getTime(); final long date2Milliseconds = date2.getTime().getTime(); final long result = (date1Milliseconds - date2Milliseconds) / msPerDay; return result; }// w w w .j ava 2 s . c o m }