Write code to check Date In Between Days
import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) { Date appointDate = new Date(); Date startDate = new Date(); Date endDate = new Date(); System.out.println(checkDateInBetweenDays(appointDate, startDate, endDate)); }//from w w w . j a v a2s. c o m public static boolean checkDateInBetweenDays(Date appointDate, Date startDate, Date endDate) { if (compareDate(appointDate, endDate) < 0) { return false; } if (compareDate(appointDate, startDate) > 0) { return false; } return true; } public static long compareDate(Date start, Date end) { long temp = 0; Calendar starts = Calendar.getInstance(); Calendar ends = Calendar.getInstance(); starts.setTime(start); ends.setTime(end); temp = ends.getTime().getTime() - starts.getTime().getTime(); return temp; } }