Re: Calculating the difference of days between two dates in Java
- From: Flo 'Irian' Schaetz <iryan@xxxxxx>
- Date: Fri, 27 Jul 2007 15:54:49 +0200
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
.
- References:
- Calculating the difference of days between two dates in Java
- From: Andy Jiang
- Calculating the difference of days between two dates in Java
- Prev by Date: Calculating the difference of days between two dates in Java
- Next by Date: Re: Question for Roedy
- Previous by thread: Calculating the difference of days between two dates in Java
- Next by thread: Re: Calculating the difference of days between two dates in Java
- Index(es):