Calculate Days Between Events - Android

I looked through the Android API and looked for a way to calculate the number of days between the current date and the future date. I am new to android and I earned java in a few years. The easiest way to calculate this?

thank

0
source share
1 answer

The easiest way is to use Joda Time for this:

Date oldEventDate = ...
Date newEventDate = ...
Days days = Days.daysBetween(new DateTime(oldEventDate), new DateTime(newEventDate));
int numberOfDays = p.getDays();
0
source

Source: https://habr.com/ru/post/1796223/


All Articles