Re: Calculating the difference of days between two dates in Java



And thus spoke Andy Jiang...

Hello,everyone! I used the Date class to create two dates by invoking the
constructor Date(long date), but can anybody tell me how to calculate the
difference of days between these two dates? Which methods should I use?

Date date1 = <something>;
Date date2 = <something>;

double days = (date2.getTime() - date1.getTime())/(1000*60*60*24);

Flo
.