Java Date to Month getNextMonth(long date)

Here you can find the source of getNextMonth(long date)

Description

Returns the next month.

License

Open Source License

Parameter

Parameter Description
date Base date

Return

next month

Declaration

public static long getNextMonth(long date) 

Method Source Code


//package com.java2s;
import java.util.Calendar;

public class Main {
    private static Calendar CALENDAR = Calendar.getInstance();

    /**//from  www.  j  a v  a2s  . c o  m
     * Returns the next month.
     *
     * @param date Base date
     * @return next month
     */
    public static long getNextMonth(long date) {
        return incrementMonth(date, 1);
    }

    private static long incrementMonth(long date, int increment) {
        Calendar calendar = CALENDAR;
        synchronized (calendar) {
            calendar.setTimeInMillis(date);
            calendar.add(Calendar.MONTH, increment);
            return calendar.getTimeInMillis();
        }
    }
}

Related

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