Must be missing something simple... "9" is not the correct number of days between 7/1/2021 and 12/10/2021
B4X:
Dim DateSobriety As String = iMap.Get("datesobriety") ' this is 2021-07-01 in database
DateTime.DateFormat = "yyyy-MM-dd"
Dim StartTime As Long = DateTime.DateParse(DateSobriety)
Dim PerDiff As Period
PerDiff = DateUtils.PeriodBetween(StartTime, DateTime.Now)
Log("StartTime : " & DateTime.Date(StartTime))
Log("Today : " & DateTime.Date(DateTime.Now))
Log("Days diff.: " & PerDiff.Days)
Log:
StartTime : 2021-07-01
Today : 2021-12-10
Days diff.: 9