Java在当前时间的基础上增加N时间

long currentTime = System.currentTimeMillis() +想要增加的时间毫秒数;

Date date = new Date(currentTime);

 

 

增加整数N天的话

import org.apache.commons.lang3.time.DateUtils;

Date now = new Date();
Date startDate = DateUtils.addDays(now, 30);

上面表示往后30天,-30就是往前三十天

posted @ 2019-09-11 09:47  Ice_Blue_Brother  阅读(727)  评论(0编辑  收藏  举报