如18:30:30,+5minutes =18:35:30vb里有个dateadd函数,但当时间过大后就会溢出从而显示成日期。我自己写了个addtime()函数,但感觉太繁锁,有没有谁写过比较简易的函数?下面是这个函数。
Public Function addtime(ByVal t As Date, ByVal h As Integer, ByVal m As Integer, ByVal s As Integer) As Date
Dim hrs As Integer
Dim mins As Integer
Dim secs As Integerhrs = Hour(t)
mins = Minute(t)
secs = Second(t)s = s + secs
m = m + mins
h = h + hrsIf m = 0 And s < 0 Then m = 60
If m > 60 Then
 m = m - 60
 h = h + 1
End If
If h > 24 Then h = h - 24If h = 0 And m < 0 Then h = 24
If m > 0 And h = 24 Then h = 0addtime = TimeSerial(h, m, s)End Function