Java Calendar Add addDays(Calendar calendar, int days)

Here you can find the source of addDays(Calendar calendar, int days)

Description

Add the given amount of days to the given calendar.

License

Apache License

Parameter

Parameter Description
calendar The calendar to add the given amount of days to.
days The amount of days to be added to the given calendar. Negative values are also allowed, it will just go back in time.

Declaration

public static void addDays(Calendar calendar, int days) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    /**//  ww  w .j av  a 2s  . co m
     * Add the given amount of days to the given calendar. The changes are reflected in the given
     * calendar.
     * @param calendar The calendar to add the given amount of days to.
     * @param days The amount of days to be added to the given calendar. Negative values are also
     * allowed, it will just go back in time.
     */
    public static void addDays(Calendar calendar, int days) {
        calendar.add(Calendar.DATE, days);
    }
}

Related

  1. addDate(Calendar baseDate, int diffDate, TimeZone timezone)
  2. addDate(Date date, int calendarField, int amount)
  3. addDate(Date date, int calendarField, int numberToAdd)
  4. addDayOffset(final Calendar date, long offset)
  5. addDays(Calendar aTarget, int aAddDays)
  6. addDays(Calendar src, int days)
  7. addDays(final int days, final Calendar from)
  8. addDayToCalendar(Calendar calendar, int day)
  9. addLocaleToCalendar(Calendar date, String locale)