Here you can find the source of addMonth(Date date, int month)
Parameter | Description |
---|---|
date | the date |
month | the month |
public static Date addMonth(Date date, int month)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.Calendar; import java.util.Date; public class Main { /**/*from ww w.j av a 2 s . c o m*/ * Addiert einen Monat. * * @param date the date * @param month the month * @return the date */ public static Date addMonth(Date date, int month) { final Calendar cal = getCalendarInstance(); cal.setTime(date); cal.add(Calendar.MONTH, month); final Date result = cal.getTime(); return result; } /** * Locale? * * @return Eine neue Instanz. */ private static Calendar getCalendarInstance() { final Calendar cal = Calendar.getInstance(); return cal; } }