Java Calendar Day getNextDay(Calendar calendar, int day)

Here you can find the source of getNextDay(Calendar calendar, int day)

Description

get Next Day

License

Open Source License

Parameter

Parameter Description
calendar ex:2007/01/01
day number of next ex:5

Return

Calendar ex:2007/01/06

Declaration

public static Calendar getNextDay(Calendar calendar, int day) 

Method Source Code

//package com.java2s;
/*//w w  w .  j a va2s  .com
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Calendar;

public class Main {
    /**
     * @param calendar ex:2007/01/01
     * @param day number of next ex:5
     * @return Calendar ex:2007/01/06
     * @example Calendar nextDate = DateUtils.getNextDay(
     * DateUtils.getCurrentDateCalendarEng(), 5 );
     */
    public static Calendar getNextDay(Calendar calendar, int day) {
        Calendar nextDay = (Calendar) calendar.clone();
        nextDay.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + day);
        return nextDay;
    }
}

Related

  1. getJulianDay(Calendar currentDate)
  2. getLastDay(Date targetDate, Calendar cal)
  3. getLastDayOfPreviousPeriod(int startDayOfPeriod, Calendar cal)
  4. getMonday(Calendar calendar)
  5. getNextDay(Calendar cal)
  6. getNextMonday(Calendar date)
  7. getNoonOfDay(Date day, Calendar cal)
  8. getOneDayLaterCalendar(Date date)
  9. getPrincipalAfterCompoundingInterest( Calendar currentDate, Float principal, Integer depositPeriod, double interestPerDay, Integer compoundingInterval, Integer postingInterval)