我刚刚写了一个代码来查看两个格式的持续时间的添加hh:mm:ss
;但没有得到我正在寻找的那个。
代码
Option Explicit
Dim v1 : v1 = #20:20:10#
Dim v2 : v2 = #20:20:10#
MsgBox (v1 + v2)
输出作为12/31/1899 4:40:20 PM
你能在这里指导我吗?
更新
代码
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)
输出为40:62:20
更新代码
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