DateTime d1 = ...;
DateTime d2 = ...;
Period period = new Period(d1, d2, PeriodType.minutes());
int differenceMinutes = period.getMinutes();
In practice I think this will always give the same result as the answer based on Duration
. For a different time unit than minutes, though, it might be more correct. For example there are 365 days from 2016/2/2 to 2017/2/1, but actually it's less than 1 year and should truncate to 0 years if you use PeriodType.years()
.
In theory the same could happen for minutes because of leap seconds, but Joda doesn't support leap seconds.