java获取指定时间后的日期:
/**
* 获取指定时间后x天后的日期
* @param: day 指定x天
* @param: now 现在时间
* @date: 2016年1月5日 10:18:26
*/
public Date getAppointedDaysLater(int day,Date now) {
return new Date(now.getTime()+day*24*60*60*1000L);
}
/**
* 获取指定时间后x小时后的日期
* @param: hours 指定x小时
* @param: now 现在时间
* @date: 2016年1月5日 10:31:46
*/
public Date getAppointedHoursLater(int hours,Date now) {
return new Date(now.getTime()+hours*60*60*1000L);
}
/**
* 获取指定时间后x天后的日期
* @param: minutes 指定x分钟
* @param: now 现在时间
* @date: 2016年1月5日 10:29:02
*/
public Date getAppointedMinutesLater(int minutes,Date now) {
return new Date(now.getTime()+minutes*60*1000L);
}