输入字符串格式的日期,以及前后调整的天数
//日期调整
public String getDate(String predate, int days){
String afterDate = predate;
try{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = dateFormat.parse(predate);
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(date);
gc.add(GregorianCalendar.DATE, days);
date = gc.getTime();
afterDate = dateFormat.format(date);
}catch(Exception e) {
e.printStackTrace();
}
return afterDate;
}