Here you can find the source of isAtMostNMonthsAgo(long date, int howMany)
public static boolean isAtMostNMonthsAgo(long date, int howMany)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static boolean isAtMostNMonthsAgo(long date, int howMany) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, -howMany); Date d = new Date(date); return d.after(cal.getTime()); }//from w ww .j a va 2 s . c o m }