Note that you can use DateUtils with B4J:
https://www.b4x.com/android/forum/t...fies-date-and-time-calcuations.26290/#content
It calculates the time difference differently. The time span is the accumulation of the components.
Example:
Code:
Dim startDate As Long = DateUtils.SetDateAndTime(2016, 1, 1, 0, 0, 0)
Dim endDate As Long = DateUtils.SetDateAndTime(2016, 11, 26, 0, 8, 5)
Dim p As Period = DateUtils.PeriodBetween(startDate, endDate)
Log(p)
Dim p As Period = DateUtils.PeriodBetweenInDays(startDate, endDate)
Log(p)
Output:
Years=0, Months=10 , Days=25, Hours=0, Minutes=8, Seconds=5
Years=0, Months=0, Days=330, Hours=0, Minutes=8, Seconds=5
It is surprisingly difficult to get this result with the Java API.