how can calculate time in vb 6
like..(30:30:00+20:15:00)=50:45:00
30 hours and 30 minutes + 20 hours and 15 minutes
i use this
Dim Time1 As String
Dim Time2 As String
Dim Hours As Integer
Dim Minutes As Integer
Time1 = "30:30"
Time2 = "20:45"
Hours = CInt(Split(Time1, ":")(0)) + CInt(Split(Time2, ":")(0))
Minutes = CInt(Split(Time1, ":")(1)) + CInt(Split(Time2, ":")(1))
Hours = Hours + CInt(Minutes / 60 - 0.5)
Minutes = Minutes Mod 60
Debug.Print Hours & ":" & Minutes
but if the number is long in run i have error " over flow "
like..(40644:30:00+20:15:00)=406024:45:00
40644 hours and 30 minutes + 20 hours and 15 minutes
like..(30:30:00+20:15:00)=50:45:00
30 hours and 30 minutes + 20 hours and 15 minutes
i use this
Dim Time1 As String
Dim Time2 As String
Dim Hours As Integer
Dim Minutes As Integer
Time1 = "30:30"
Time2 = "20:45"
Hours = CInt(Split(Time1, ":")(0)) + CInt(Split(Time2, ":")(0))
Minutes = CInt(Split(Time1, ":")(1)) + CInt(Split(Time2, ":")(1))
Hours = Hours + CInt(Minutes / 60 - 0.5)
Minutes = Minutes Mod 60
Debug.Print Hours & ":" & Minutes
but if the number is long in run i have error " over flow "
like..(40644:30:00+20:15:00)=406024:45:00
40644 hours and 30 minutes + 20 hours and 15 minutes