GregorianCalendar last = new GregorianCalendar(py,pm-1,pd);
System.out.println(last.getTime());
GregorianCalendar present = new GregorianCalendar(py,pm-1,pd);
System.out.println(present.getTime());
long diff = Math.abs(prsent.getTime() - last.getTime());
减去这两个日期时遇到的问题
答案 0 :(得分:0)
ChronoUnit可以用于日期之间的区别:
long minutesDiff = ChronoUnit.MINUTES.between(present.toInstant(), last.toInstant());