Here you can find the source of daysBetween(Date d1)
public static int daysBetween(Date d1)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { private static Calendar cal = new GregorianCalendar(); public static int daysBetween(Date d1) { return (int) ((cal.getTime().getTime() - d1.getTime()) / (1000 * 60 * 60 * 24)); }//from ww w .j ava2 s. com }