[RESOLVED] calculations with Time
can calculations be performed with time?
ie can I do at some point:
Code:
startTime = Time
.
.
and then later on
.
.
otherTime = Time
totalTime = otherTime-startTime?
or something like:
Code:
tenMinsAgo = Time - 00:10:00
???
any help much appreciated :)
Re: calculations with Time
Here are a couple of examples if this is what you are looking for
Code:
Private Sub Command1_Click()
Dim SubHours As Integer
SubHours = CInt(Text1.Text)
MsgBox DateAdd("h", -SubHours, Time)
End Sub
'or
MsgBox DateDiff("h", #8:30:00 AM#, #12:30:00 PM#)
Re: calculations with Time
Subtraction works as long as its in the same day, if spanning occurs then http://www.vbforums.com/showthread.php?t=471664