java.text.SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    try {
     Date begindate = format.parse(ins.getData().toString());//ins.getData()是一个日期类型的字段
     Date date1 = new Date();
     long day = (date1.getTime() - begindate.getTime()) / (24 * 60 * 60 * 1000);
     // System.out.println("相隔的天数"+day);
     if (day <= Integer.parseInt(7)) {// 判断天数 没有过指定的天数
       //接着做其他的事情

     }
    } catch (ParseException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }

相关文章:

  • 2022-12-23
  • 2022-03-11
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
猜你喜欢
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案