7,763
社区成员
发帖
与我相关
我的任务
分享
197
00:13:12,496 --> 00:13:13,496
It' s really very simple.
198
00:13:14,080 --> 00:13:15,080
Is there a problem?
199
00:13:15,879 --> 00:13:16,879
Aren' t you happy here?
200
00:13:19,287 --> 00:13:20,287
Yes. But I would like to know what plans you have for me.
Option Explicit
Private Sub Command1_Click()
Debug.Print TimeAdd("00:13:13,496", "00:13:20,287")
End Sub
Public Function TimeAdd(ByVal strTime1 As String, ByVal strTime2 As String) As String
Dim tmp() As String
Dim strHMS1 As String, strHMS2 As String
Dim intMS1 As Integer, intMS2 As Integer
Dim datResult As Date
On Error GoTo exitfunction
tmp = Split(strTime1, ",")
strHMS1 = tmp(0)
If UBound(tmp) = 1 Then
intMS1 = CInt(tmp(1))
End If
tmp = Split(strTime2, ",")
strHMS2 = tmp(0)
If UBound(tmp) = 1 Then
intMS2 = CInt(tmp(1))
End If
datResult = CDate(strHMS1) + CDate(strHMS2)
intMS1 = intMS1 + intMS2
If (intMS1 >= 1000) Then
datResult = datResult + CDate("00:00:01")
intMS1 = intMS1 - 1000
End If
exitfunction:
TimeAdd = Format(datResult, "HH:nn:ss") & "," & CStr(intMS1)
End Function