Here you can find the source of calculateDaysBetween(final Calendar start, final Calendar end)
public static int calculateDaysBetween(final Calendar start, final Calendar end)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { public static int calculateDaysBetween(final Calendar start, final Calendar end) { final Date startDate = start.getTime(); final Date endDate = end.getTime(); long milliseconds = (endDate.getTime() - startDate.getTime()) % (1000l * 60l * 60l * 24l); return (int) TimeUnit.MILLISECONDS.toMinutes(milliseconds); }//w w w. jav a 2 s . c o m }