|
-
Mar 19th, 2000, 11:51 PM
#1
Thread Starter
Member
Hi,
I am trying to get the difference if time and I am having problem, here is my code, any help is appretiated. Thanks in advance!
Dim MyTime As Date
Dim MyMinute As Date
Dim m As Date
Dim m2 As Date
Dim h As Date
MyTime = #6:35:17 PM# ' Assign a time.
m = #5:30:17 PM# ' Assign a time.
MyMinute = Minute(MyTime) ' MyMinute contains 35.
If MyTime > m Then
h = Hour(MyTime) - Hour(m)
If h >= 0 Then
m2 = Minute(MyTime) - Minute(m)
h = m2 + h
MsgBox h
End If
End If
-
Mar 19th, 2000, 11:58 PM
#2
Hyperactive Member
I could be confusing you here, but one approach would be to convert both times into seconds, do the subtraction, then convert the result back into hhmmss.
-
Mar 20th, 2000, 12:02 AM
#3
transcendental analytic
How about using a simple function:
DateDiff(interval, date1, date2)
where interval can be set to:
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
Hope you can use it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|