Here you can find the source of getDifferenceDays(Date d1, Date d2)
public static long getDifferenceDays(Date d1, Date d2)
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { public static long getDifferenceDays(Date d1, Date d2) { long diff = d2.getTime() - d1.getTime(); return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); }//from ww w. j ava 2 s. c om }