Here you can find the source of daysBetweenDate(Date date1, Date date2)
public static long daysBetweenDate(Date date1, Date date2)
//package com.java2s; import java.util.Date; public class Main { public static long daysBetweenDate(Date date1, Date date2) { long d = date1.getTime() - date2.getTime(); return d / 86400000; }/*from w w w.j a va2 s . c o m*/ }