Here you can find the source of getDays(Date date1, Date date2)
public static final int getDays(Date date1, Date date2)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static final int getDays(Date date1, Date date2) { Long days = date1.getTime() - date2.getTime(); return (int) (days / 1000 / 3600 / 24); }//w ww.ja va 2 s .c om }