Question:
I previously asked a question that may not have been worded as clearlyas possible and you answered something slightly different from what Iwas looking for. I want to know how to subtract one date from anotheras in the following pseudo-code:
calender1.setTime(databasedate)calender2.setTime(todaysdate)differenceindays = calender2 - calender1
How can I determine the difference in days between two Calendar dates?
Answer:
To do this you must convert your Calendar times to Date objects withCalendar.getTime(). Then convert your Date objects to longsrepresenting the number of milliseconds since midnight January 1,1970. Date.getTime() will do this. Now subtract the two times anddivide by the number of milliseconds in a day.