0

ANDROID:

Wanted to know whether is there any API or workaround to know that DAY X + N DAYS ahead or behind was the day that will be / was of next month / previous month.

Ravibhushan
  • 171
  • 3
  • 14

1 Answers1

1
public static Date getCurrentDatePlusDays(int days) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_YEAR, days);
        Date newDate = calendar.getTime();
        return newDate;
    }

then check the month or year.

Bob
  • 22,810
  • 38
  • 143
  • 225