Here you can find the source of dayDiff(Date first, Date second)
public static int dayDiff(Date first, Date second)
//package com.java2s; /*//from w ww . j a va 2 s . c o m * Copyright 2007 Sun Microsystems, Inc. * All rights reserved. You may not modify, use, * reproduce, or distribute this software except in * compliance with the terms of the License at: * http://developer.sun.com/berkeley_license.html */ import java.util.*; public class Main { public static int dayDiff(Date first, Date second) { // returns the difference, in days, between the first // and second Date arguments long msPerDay = 1000 * 60 * 60 * 24; long diff = (first.getTime() / msPerDay) - (second.getTime() / msPerDay); Long convertLong = new Long(diff); return convertLong.intValue(); } }