Here you can find the source of compareDate(Date start, Date end)
public static long compareDate(Date start, Date end)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static long compareDate(Date start, Date end) { long temp = 0; Calendar starts = Calendar.getInstance(); Calendar ends = Calendar.getInstance(); starts.setTime(start);/*from w w w . j av a2 s .c o m*/ ends.setTime(end); temp = ends.getTime().getTime() - starts.getTime().getTime(); return temp; } }