Skip to content Skip to sidebar Skip to footer

Current Day + N Days Is The Day Of Next Month Or Previous Month

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.

Solution 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.


Post a Comment for "Current Day + N Days Is The Day Of Next Month Or Previous Month"