List of utility methods to do Month Add
Date | addMonth(Date date, int month) add Month Date retDate = (Date) date.clone();
retDate.setMonth(retDate.getMonth() + month);
return retDate;
|
Date | addMonth(Date date, int month) Addiert einen Monat. final Calendar cal = getCalendarInstance(); cal.setTime(date); cal.add(Calendar.MONTH, month); final Date result = cal.getTime(); return result; |
Date | addMonth(Date date, int months) add Month Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, months);
return cal.getTime();
|
Date | addMonths(Date date, int iMonthCount) add Months Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, iMonthCount);
return calendar.getTime();
|
Date | addMonths(Date date, int months) Add specified number of months to the date given. if (months == 0) return date; if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.MONTH, months); return cal.getTime(); ... |
String | addMonths(int updateInterval, String dateFormat) Add months to todays date and return as string if (updateInterval == -1) return "Exempt"; SimpleDateFormat timeFormat = new SimpleDateFormat(dateFormat); Calendar tCalendar = Calendar.getInstance(); Date tDate = new Date(); Integer year = Integer.parseInt(new SimpleDateFormat(separateDate(dateFormat, "y")).format(tDate)); Integer month = Integer.parseInt(new SimpleDateFormat(separateDate(dateFormat, "M")).format(tDate)) - 1; Integer day = Integer.parseInt(new SimpleDateFormat(separateDate(dateFormat, "d")).format(tDate)); ... |
java.util.Date | addMonths(java.util.Date today, int monthsToAdd) addMonths: returns date + given months if (today != null) { java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(today); c.add(Calendar.MONTH, monthsToAdd); return c.getTime(); } else { return null; |
String | addMonths(String s, int month) add Months return addMonths(s, month, "yyyyMMdd"); |
String | addMonths2(String dateStr, int months) add Months Date date = getStrDateToDate(dateStr); date = addMonths(date, months); date = addDays(date, -1); SimpleDateFormat formatter; formatter = new SimpleDateFormat("yyyy" + getDateSplit() + "MM" + getDateSplit() + "dd"); String dateString = formatter.format(date); return dateString.trim(); |
Date | addMonthsAndDays(Date date, int months, int days) add Months And Days Calendar sysDate = new GregorianCalendar(); sysDate.setTime(date); sysDate.add(Calendar.MONTH, months); sysDate.add(Calendar.DAY_OF_MONTH, days); return sysDate.getTime(); |