Java Calendar Add addMonth(Calendar cal, int period)

Here you can find the source of addMonth(Calendar cal, int period)

Description

add Month

License

Apache License

Declaration

public static Calendar addMonth(Calendar cal, int period) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static final String MONTH = "MM";

    public static Calendar addMonth(Calendar cal, int period) {
        Calendar cal2 = cal;//from w  w w  .j a va  2  s.c  o  m
        cal2.set(Calendar.MONTH, cal.get(Calendar.MONTH) + period);

        return cal;
    }
}

Related

  1. addDays(Calendar src, int days)
  2. addDays(final int days, final Calendar from)
  3. addDayToCalendar(Calendar calendar, int day)
  4. addLocaleToCalendar(Calendar date, String locale)
  5. addMilliseconds(Calendar calendar, Long amount)
  6. addMonthDayToCal(Calendar cal, int month, int day)
  7. addSeconds(Calendar calendar, int amount)
  8. addToUTCMilliSeconds(int calendarTime, int actualValue)
  9. addWeekdays(Calendar cal, int days)