Here you can find the source of addCalendarMonthsToUnixtime(long time, int interval)
Parameter | Description |
---|---|
time | the base-time (in milliseconds) to which the amount of months is added |
interval | the amount of months to be added |
public static final long addCalendarMonthsToUnixtime(long time, int interval)
//package com.java2s; /**//ww w. j av a2 s . co m * Copyright (c) 2012 Todoroo Inc * * See the file "LICENSE" for the full license governing this code. */ import java.util.Calendar; public class Main { /** * Add the specified amount of months to the given time.<br/> * The day of month will stay the same.<br/> * * @param time the base-time (in milliseconds) to which the amount of months is added * @param interval the amount of months to be added * @return the calculated time in milliseconds */ public static final long addCalendarMonthsToUnixtime(long time, int interval) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); c.add(Calendar.MONTH, interval); return c.getTimeInMillis(); } }