Java Date to Month getNextMonth(Date time)

Here you can find the source of getNextMonth(Date time)

Description

get Next Month

License

Open Source License

Declaration

public static Date getNextMonth(Date time) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date getNextMonth(Date time) {
        Calendar calendar = Calendar.getInstance();
        if (null != time) {
            calendar.setTimeInMillis(time.getTime());
        }//from  w w w  .jav  a 2  s  .  c o  m
        calendar.add(Calendar.MONTH, 1);
        return new Date(calendar.getTimeInMillis());
    }

    public static Date getNextMonth(Date time, int after) {
        Calendar calendar = Calendar.getInstance();
        if (null != time) {
            calendar.setTimeInMillis(time.getTime());
        }
        calendar.add(Calendar.MONTH, after);
        return new Date(calendar.getTimeInMillis());
    }
}

Related

  1. getMonths(Date date1, Date date2)
  2. getMonthStart(Date date)
  3. getMonthStart(Date date)
  4. getMonthStartDay(Date date)
  5. getNextMonth(Date baseDate, int Month)
  6. getNextMonth(long date)
  7. getNextMonthDate(Date appointDate)
  8. getNextMonthExtention(Date dt, Long n)
  9. getNextMonthFirstDate(Date date)