0

I been looking thru the Android API and been looking for a way to calculate the number of days between the current date and a future date. I'm pretty new to android and i havent done java in a few years. Whats the easiest method to calculate this?

Thanks

CommonsWare
  • 954,112
  • 185
  • 2,315
  • 2,367

1 Answers1

0

The easiest way is to use the Joda Time Days class for this:

Date oldEventDate = ...
Date newEventDate = ...
Days days = Days.daysBetween(new DateTime(oldEventDate), new DateTime(newEventDate));
int numberOfDays = p.getDays();
Jose Diaz
  • 5,273
  • 1
  • 29
  • 29