akhter wahab wrote:why its 10/21/2010 ?? it should 10/20/2010
The string date is actually 5 hours behind GMT and your current time zone seems to be in Pakistan which is +5/+6 hours ahead of GMT. Hence the difference.
akhter wahab wrote:
its output is Days Between Thu Oct 21 00:50:11 PKST 2010 and Mon Nov 08 19:06:04 PKT 2010 is 18
but still its not fullfiling my requirment of Difference in Days 3.2
The sample dates that you are using here are different from the ones in your original post. The difference looks to be ok. Try using
(float)(24 * 3600 * 1000)
to get more precise values.
thanks it really helps me allot
and still now can't found any way for Difference 77:17:14
Joined: Mar 20, 2007
c2.getTime().getTime() - c1.getTime().getTime()
1) This gives the time in millis.
2) divide by 1000 to get the total number of seconds.
3) divide the resulting number by 3600 to get the hours.
4) divide the remainder by 60 to get the minutes.
5) the remainder, now should be the seconds.
try using the modulo operator.