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
  • 986,068
  • 189
  • 2,389
  • 2,491
Brian Weaver
  • 43
  • 1
  • 7

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,353
  • 1
  • 31
  • 29