Here you can find the source of isAtLeastOneDayBefore(Date daybefore, Date dayafter)
public static boolean isAtLeastOneDayBefore(Date daybefore, Date dayafter)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static boolean isAtLeastOneDayBefore(Date daybefore, Date dayafter) { Calendar calBefore = Calendar.getInstance(); Calendar calAfter = Calendar.getInstance(); calBefore.setTime(daybefore);//w w w . j ava 2s . c o m calAfter.setTime(dayafter); return calBefore.get(Calendar.YEAR) == calAfter.get(Calendar.YEAR) && calBefore.get(Calendar.DAY_OF_YEAR) + 1 <= calAfter.get(Calendar.DAY_OF_YEAR); } }