Java tutorial
//package com.java2s; import java.util.Date; public class Main { public static long getDifferenceBetweenTwoDates(Date begin, Date end) { long difference = begin.getTime() - end.getTime(); // seconds long seconds = difference / 1000; // minutes long minutes = seconds / 60; // hours long hours = minutes / 60; // days long days = hours / 24; return days; } }