Java Calendar Month getNextMonth(Calendar calendar, int month)

Here you can find the source of getNextMonth(Calendar calendar, int month)

Description

get Next Month

License

Open Source License

Parameter

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

Return

Calendar ex:2007/05/01

Declaration

public static Calendar getNextMonth(Calendar calendar, int month) 

Method Source Code

//package com.java2s;
/*// w  ww  .j  a  v a 2  s .  c o m
 * 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 month number of next month ex:5
     * @return Calendar ex:2007/05/01
     * @example Calendar nextDate = DateUtils.getNextMonth(
     * DateUtils.getCurrentDateCalendarEng(), 5 );
     */
    public static Calendar getNextMonth(Calendar calendar, int month) {
        calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) + month);
        return calendar;
    }
}

Related

  1. getMonthBegin(Calendar calendar)
  2. getMonthName(Calendar cal)
  3. getMonthStart(Calendar c)
  4. getMonthStart(Calendar cal)
  5. getMonthStr(Calendar cal)
  6. getNumDaysInMonth(GregorianCalendar aCalendar)
  7. getStartOfMonth(Date day, Calendar cal)
  8. incrementMonth(Calendar cal)
  9. incrementMonthByVal(Calendar theCal, int val)