Here you can find the source of compareDate(Date date1)
public static int compareDate(Date date1)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int compareDate(Date date1) { Calendar c = Calendar.getInstance(); c.clear();/*from ww w .j a v a 2 s . c o m*/ Date date2 = c.getTime(); long quot; quot = date1.getTime() - date2.getTime(); quot = quot / 1000 / 60 / 60 / 24; int day = new Long(quot).intValue(); return day; } }