Here you can find the source of getDateBeforeNextMonth(Date date, Integer month, Integer day)
public static Date getDateBeforeNextMonth(Date date, Integer month, Integer day)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import java.util.Locale; public class Main { public static Date getDateBeforeNextMonth(Date date, Integer month, Integer day) { if (date == null || month == null || day == null) { return date; }//from w w w .j a v a2 s .c om Calendar cal = Calendar.getInstance(Locale.CHINA); cal.setTime(date); cal.add(Calendar.MONTH, month); cal.add(Calendar.DATE, day); return cal.getTime(); } }