public static java.util.Date getBeforeAfterDateMonth(Date date, int month) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
int Year = cal.get(Calendar.YEAR);
int Month = cal.get(Calendar.MONTH);
int Day = cal.get(Calendar.DAY_OF_MONTH);
int NewMonth = Month + month;
cal.set(Calendar.YEAR, Year);
cal.set(Calendar.MONTH, NewMonth);
cal.set(Calendar.DAY_OF_MONTH, Day);
return new Date(cal.getTimeInMillis());
}
计算某天n月之后的日期
猜你喜欢
转载自blog.csdn.net/gaofenglxx/article/details/60139933
今日推荐
周排行