I am struggling with the time values that come out of the TimeDialog. It seems I can determine the interval between two absolute values, I can also add those intervals to another absolute value and get the correct result. My problem is that I am unable to display an interval (HH:mm) derived from two other values. The last line of the code does not give the correct value. I tried looking at the DateUtils but I don't see anything that helps.
Can anyone provide a correct solution please?
Can anyone provide a correct solution please?
DateTime Arithmetic:
Sub Activity_Create(FirstTime As Boolean)
DateTime.TimeFormat = "HH:mm"
Dim td As TimeDialog
td.Is24Hours = True
Dim StartTime,FinishTime, TotalTime, EachPeriod As Long
td.Show("Enter Start Time","Start Time","OK","Cancel","",Null)
Dim StartTime As Long = td.TimeTicks
td.Show("Enter Finish Time","Start Time","OK","Cancel","",Null)
FinishTime = td.TimeTicks
TotalTime = FinishTime - StartTime
EachPeriod = TotalTime / 3
Dim FirstPeriodStarts, SecondPeriodStarts, ThirdPeriodStarts As Long
FirstPeriodStarts = StartTime
SecondPeriodStarts = FirstPeriodStarts + EachPeriod
ThirdPeriodStarts = SecondPeriodStarts + EachPeriod
Log(DateTime.Time(StartTime)) 'These values all correct
Log(DateTime.Time(SecondPeriodStarts))
Log(DateTime.Time(ThirdPeriodStarts))
Log(DateTime.Time(FinishTime))
Log(DateTime.Time(TotalTime)) 'Does not work!
End Sub