Here you can find the source of nowInDateEquals(Date now, Date d1, Date d2)
public static boolean nowInDateEquals(Date now, Date d1, Date d2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static boolean nowInDateEquals(Date now, Date d1, Date d2) { if (compareDateEquals(d1, now)) { return true; } else if (compareDateEquals(d2, now)) { return true; } else if (now.after(d1) && now.before(d2)) { return true; }/* w w w. j a v a 2s . c o m*/ return false; } public static boolean compareDateEquals(Date d1, Date d2) { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTime(d1); c2.setTime(d2); int result = c1.compareTo(c2); if (result == 0) return true; else return false; } }