I just wrote a code to see the addition of two time durations which are in hh:mm:ss
format;but not getting the one I am looking for.
CODE
Option Explicit
Dim v1 : v1 = #20:20:10#
Dim v2 : v2 = #20:20:10#
MsgBox (v1 + v2)
OUTPUT Coming as 12/31/1899 4:40:20 PM
Could you guide me here?
Update
Code
Option Explicit
Dim V1 : v1 = #20:20:10#
Dim V2 : v2 = #20:42:10#
MsgBox (Hour(V1) + Hour(V2)) & ":" & Minute(V1) + Minute(V2) & ":" & Second(V1) + Second(V2)
Output Coming as 40:62:20
UPDATED CODE
SumDate = "00:00:00"
For IndexSearch = 0 To ArrayListTaskDetails.Count - 1 Step 4
dt1 = ArrayListTaskDetails(IndexSearch + 3)
SumDate = TimeAdd(dt1,SumDate)
Loop
Function TimeAdd(dt1,dt2)
If (IsDate(dt1) And IsDate(dt2)) = False Then
TimeAdd = "00:00:00"
Exit Function
End If
TimeAdd = Hour(dt1)+Hour(dt2) & ":" & Minute(dt1)+Minute(dt2) & ":" & Second(dt1)+Second(dt2)
End Function