Here you can find the source of differenceDay(Date toDate, Date fromDate)
public static int differenceDay(Date toDate, Date fromDate)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static int differenceDay(Date toDate, Date fromDate) { Calendar to = Calendar.getInstance(); to.setTime(toDate);/*from www .ja v a 2s. co m*/ Calendar from = Calendar.getInstance(); from.setTime(fromDate); long day = (to.getTimeInMillis() - from.getTimeInMillis()) / 1000 / 60 / 60 / 24; return (int) day; } }