Here you can find the source of getDiffDays2(Date one, Date two)
public static int getDiffDays2(Date one, Date two)
//package com.java2s; import java.util.*; public class Main { public static int getDiffDays2(Date one, Date two) { Calendar sysDate = new GregorianCalendar(); sysDate.setTime(one);/* w ww .j a v a 2s . co m*/ Calendar failDate = new GregorianCalendar(); failDate.setTime(two); return (int) ((sysDate.getTimeInMillis() - failDate.getTimeInMillis()) / (24 * 60 * 60 * 1000)); } }