/**
* Get the date n years ago
* @param year number of years
* @return
*/
public static String getYearDate(int year){
Calendar curr = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
curr.set(Calendar.YEAR,curr.get(Calendar.YEAR)-year);
return sdf.format( curr.getTime() );
}
/**
* Get the date n days ago
* @param year number of years
* @return
*/
public String getYearDate(int day,String format){
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, day );
return new SimpleDateFormat( format ).format(cal.getTime());
}