How to calculate the date difference in Android?
+1
A:
If you can't afford 3rd party libraries like JodaTime, then your best bet is really java.util.Calendar. You can use the Calendar#add() method in a loop to calculate the difference in years, months and days between two instances. Then to calculate the difference in hours, minutes and seconds, just do the usual math on Calendar#getTimeInMillis().
Long story short, I've posted a basic example before here. You may find it useful.
BalusC
2010-08-13 02:48:02