Date enrollDate = inter.getEnrollDate(); //可以自己创个时间节点 Date today = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if (enrollDate != null) { String end = sdf.format(enrollDate); String time = sdf.format(today); try { enrollDate = sdf.parse(end); today = sdf.parse(time); } catch (ParseException e) { e.printStackTrace(); } } long enrollDays = (today.getTime() - enrollDate.getTime()) / (24 * 60 * 60 * 1000);
计算一个日期到今天相差的天数
最新推荐文章于 2024-05-29 16:44:16 发布