Here you can find the source of numberOfDaysBetween(Calendar start, Calendar end)
public static int numberOfDaysBetween(Calendar start, Calendar end)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { private static long numberOfMSInADay = 1000 * 60 * 60 * 24; public static int numberOfDaysBetween(Calendar start, Calendar end) { long span = end.getTimeInMillis() - start.getTimeInMillis(); return (int) (span / numberOfMSInADay); }//ww w. j ava 2 s.c o m }