-
Mar 27th, 2002, 09:52 AM
#1
Thread Starter
Hyperactive Member
Adding
If I have two values one = 8.45 (meaning 8 hours and 45 mins)
and number two = 8.15
My Answer will be 16.6 hours
How do I get it to realise that it is not 16.6 hours but 17 hours??
Regards
Matt
-
Mar 27th, 2002, 09:55 AM
#2
Bouncy Member
don't use numbers to represent time.
use date values.
ie.
VB Code:
Private Sub Form_Load()
Dim dtmDate1 As Date
Dim dtmDate2 As Date
dtmDate1 = #8:16:00 AM#
dtmDate2 = #9:00:00 AM#
MsgBox "There are " & DateDiff("n", dtmDate1, dtmDate2) & " minutes difference."
End Sub
-
Mar 27th, 2002, 10:00 AM
#3
Bouncy Member
or in your case
VB Code:
Private Sub Form_Load()
Dim dtmNothing As Date
Dim dtmDate1 As Date
Dim dtmDate2 As Date
Dim dtmResult As Date
dtmNothing = #12:00:00 AM#
dtmDate1 = #8:45:00 AM#
dtmDate2 = #8:15:00 AM#
dtmResult = DateAdd("s", DateDiff("s", dtmNothing, dtmDate2), dtmDate1)
MsgBox dtmResult
End Sub
-
Mar 27th, 2002, 10:32 AM
#4
Thread Starter
Hyperactive Member
Thanks
Thankyou for your help once again,
It works like a charm now!
Thanks Again.
-
Mar 27th, 2002, 10:34 AM
#5
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
|