`
xiyuliuguang
  • 浏览: 31379 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

获取第几天后的日期

阅读更多
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());
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics