public String plusDay(String starttime,int num){ System.out.println("开始日期:" + starttime); Date d = new Date(); Calendar ca = Calendar.getInstance(); ca.add(Calendar.DATE, num);// num为增加的天数,可以改变的 d = ca.getTime(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String enddate = format.format(d); System.out.println("结束日期:" + enddate); return enddate; }