/**
* 獲取當前,後三個月時間.
* @return date
*/
public static Date getLastMonthToDate() {
Date date = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, 3);
return cal.getTime();
}
.net
/**
* 獲取當前,後三個月時間.
* @return string
*/
public static String getLastMonthToStr() {
Date date = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, 3);
Date otherDate=cal.getTime();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
return dateFormat.format(otherDate);orm
}get