List of utility methods to do Year Ago
GregorianCalendar | getHundredYearsAgo() get Hundred Years Ago final GregorianCalendar retVal = new GregorianCalendar(); retVal.add(Calendar.YEAR, -100); return retVal; |
boolean | hasYearPassed(int year) has Year Passed return normalizeYear(year) < NOW.get(Calendar.YEAR);
|
Date | yearAgo() Get date for year ago return forCalendarDiff(Calendar.YEAR, -1);
|
Date | yearsAgo(int i) years Ago Calendar cal = getCalendarInstance();
cal.add(Calendar.YEAR, -i);
return cal.getTime();
|
Date | yearsAgo(int n) Get a Date for the specified number of years ago. final Calendar cal = GregorianCalendar.getInstance(); cal.setTime(new Date(System.currentTimeMillis())); cal.add(Calendar.YEAR, -n); return cal.getTime(); |