Here you can find the source of getNextMonth(long date)
Parameter | Description |
---|---|
date | Base date |
public static long getNextMonth(long date)
//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(); } } }