I am trying to calculate the difference in hours and minutes between two date/time strings, both in the format "yyMMddHHmm". I have been trying to use DateUtils but no matter what I do it always returns zero for all return values.
Above code is at start of sub.
Above code converts both dates to ticks and calls DateUtils PeriodBetween routine.
No matter what I do all values returned are zero so I think I am missing something.
Thanks.
B4X:
Dim lngTimeFrom As Long
Dim lngTimeTo As Long
Dim TimeDiff As Period
TimeDiff.Initialize
Above code is at start of sub.
B4X:
DateTime.DateFormat = "yyMMddHHmm"
DateTime.TimeFormat = "yyMMddHHmm"
lngTimeFrom = DateTime.DateTimeParse(strXFromDateTime, strXFromDateTime)
lngTimeTo = DateTime.DateTimeParse(strXToDateTime, strXToDateTime)
Log(lngTimeFrom)
Log(lngTimeTo)
DateUtils.PeriodBetween(lngTimeFrom, lngTimeTo)
Log(TimeDiff.Years)
Log(TimeDiff.Months)
Log(TimeDiff.Days)
Log(TimeDiff.Hours)
Log(TimeDiff.Minutes)
Log(TimeDiff.Seconds)
Above code converts both dates to ticks and calls DateUtils PeriodBetween routine.
No matter what I do all values returned are zero so I think I am missing something.
Thanks.