Here you can find the source of isInSameDayOrAfter(Date d1, Date d2)
public static boolean isInSameDayOrAfter(Date d1, Date d2)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static boolean isInSameDayOrAfter(Date d1, Date d2) { if (d1 == null || d2 == null) return false; if (isInSameDay(d1, d2) || d1.after(d2)) return true; return false; }//ww w . j a va 2s . c o m /** Returns true if the Dates are in the same day. Ignores time. * @param d1 Day one compared to * @param d2 Day two * @return */ public static boolean isInSameDay(Date d1, Date d2) { if (d1 == null || d2 == null) { return false; } GregorianCalendar cal1 = new GregorianCalendar(); cal1.setTime(d1); GregorianCalendar cal2 = new GregorianCalendar(); cal2.setTime(d2); return (cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)); } }