A AGS New Member Licensed User Longtime User Jun 19, 2014 #1 Please, anobody can help me?? What am I doing wrong? Dim StartTrip AsLong = DateTime.TimeParse("08:00:00") Dim EndTrip AsLong = DateTime.TimeParse("18:30:00") Dim MovementTime AsLong = DateTime.TimeParse("7:15:00") Dim TripDuration AsLong = EndTrip - StartTrip Dim StopTime AsLong = TripDuration - MovementTime Log("Duration = " & DateTime.Time(TripDuration)) Log("Movement = " & DateTime.Time(MovementTime)) Log("Stoped = " & DateTime.Time(StopTime)) ** Activity (main) Create, isFirst = true ** ** Activity (main) Resume ** Duration = 10:30:00 Movement = 07:15:00 Stoped = 04:15:00
Please, anobody can help me?? What am I doing wrong? Dim StartTrip AsLong = DateTime.TimeParse("08:00:00") Dim EndTrip AsLong = DateTime.TimeParse("18:30:00") Dim MovementTime AsLong = DateTime.TimeParse("7:15:00") Dim TripDuration AsLong = EndTrip - StartTrip Dim StopTime AsLong = TripDuration - MovementTime Log("Duration = " & DateTime.Time(TripDuration)) Log("Movement = " & DateTime.Time(MovementTime)) Log("Stoped = " & DateTime.Time(StopTime)) ** Activity (main) Create, isFirst = true ** ** Activity (main) Resume ** Duration = 10:30:00 Movement = 07:15:00 Stoped = 04:15:00
Erel B4X founder Staff member Licensed User Longtime User Jun 19, 2014 #2 Please use [ code ] [ /code ] tags (without spaces) when posting code. 1. You should use DateUtils to calculate the time difference. 2. Convert the Period to string with this code: Code: Copy Sub PeriodToString(p As Period) As String Return NumberFormat(p.Hours, 2, 0) & ":" & NumberFormat(p.Minutes, 2, 0) & ":" & _ NumberFormat(p.Seconds, 2, 0) End Sub Upvote 0
Please use [ code ] [ /code ] tags (without spaces) when posting code. 1. You should use DateUtils to calculate the time difference. 2. Convert the Period to string with this code: Code: Copy Sub PeriodToString(p As Period) As String Return NumberFormat(p.Hours, 2, 0) & ":" & NumberFormat(p.Minutes, 2, 0) & ":" & _ NumberFormat(p.Seconds, 2, 0) End Sub