Here you can find the source of compareDay(Date date1, int compday)
public static Boolean compareDay(Date date1, int compday)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Boolean compareDay(Date date1, int compday) { if (date1 == null) return false; Date dateComp = getDateBeforeOrAfter(date1, compday); Date nowdate = new Date(); if (dateComp.after(nowdate)) return true; else/* www .ja v a 2s . c om*/ return false; } public static Date getDateBeforeOrAfter(int iDate) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DAY_OF_MONTH, iDate); return cal.getTime(); } public static Date getDateBeforeOrAfter(Date curDate, int iDate) { Calendar cal = Calendar.getInstance(); cal.setTime(curDate); cal.add(Calendar.DAY_OF_MONTH, iDate); return cal.getTime(); } }