Here you can find the source of isAfterForDay(Date date, Date ref)
public static boolean isAfterForDay(Date date, Date ref)
//package com.java2s; //License from project: LGPL import java.util.Calendar; import java.util.Date; public class Main { /**//from w w w . j a v a 2 s.c o m * check if date is after other date. */ public static boolean isAfterForDay(Date date, Date ref) { if (ref == null) { return true; } Calendar calDate = Calendar.getInstance(); calDate.setTime(date); Calendar calRef = Calendar.getInstance(); calRef.setTime(ref); if (calDate.get(Calendar.YEAR) < calRef.get(Calendar.YEAR)) { return false; } else if (calDate.get(Calendar.YEAR) == calRef.get(Calendar.YEAR)) { if (calDate.get(Calendar.DAY_OF_YEAR) <= calRef.get(Calendar.DAY_OF_YEAR)) { return false; } } return true; } }