2016-12-14 23 views
-1
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()); 

問題減去這兩個日期我想通過使用公曆減去在Java日期以獲得天的差異:

+2

_問題出現時面臨什麼問題? –

回答

0

ChronoUnit時面對的,是你可以使用什麼日期之間的差值:

long minutesDiff = ChronoUnit.MINUTES.between(present.toInstant(), last.toInstant()); 
相關問題