//得到指定日期(几天前/几天后)整数往后推,负数往前移动
private Date getAppointDay(int num) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat();
String format = dateFormat.format(new Date());//格式化当前时间
Date resultDate = dateFormat.parse(format);
Calendar calendar = new GregorianCalendar();
calendar.setTime(resultDate);
calendar.add(calendar.DATE,num);//整数往后推,负数往前移动
return calendar.getTime(); //指定的日期
}

相关文章:

  • 2021-06-10
  • 2021-11-30
  • 2022-03-03
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
相关资源
相似解决方案