获取第几天后的日期
- 摘要:Calendarcal=Calendar.getInstance();try{cal.setTime(newSimpleDateFormat("yyyy-MM-dd").parse(source));}catch(ParseExceptione){e.printStackTrace();}cal.set(cal.get(Calendar.YEAR),cal.get(Calendar.MONTH),cal.get(Calendar.DATE)+step)
- 标签:
Calendar cal = Calendar.getInstance();
try {
cal.setTime(new SimpleDateFormat("yyyy-MM-dd").parse(source));
} catch (ParseException e) {
e.printStackTrace();
}
cal.set(cal.get(Calendar.YEAR),cal.get(Calendar.MONTH), cal.get(Calendar.DATE) + step);
//第2天
return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());