Here you can find the source of isIncludeDay(Date start, Date end, Date target)
public static boolean isIncludeDay(Date start, Date end, Date target)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static boolean isIncludeDay(Date start, Date end, Date target) { start = initDate(start).getTime(); Calendar endCal = initDate(end); endCal.add(Calendar.DAY_OF_MONTH, 1); end = endCal.getTime();/* ww w .j a v a 2 s .co m*/ return isIncludeDate(start, end, target); } private static Calendar initDate(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); initDate(cal); return cal; } private static void initDate(Calendar cal) { cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); } private static boolean isIncludeDate(Date start, Date end, Date target) { return ((start.compareTo(target) <= 0) && (target.compareTo(end) < 0)); } }