When is 5:00 AM not 5:00 AM? When it's 5:00 AM. 
Author Message
 When is 5:00 AM not 5:00 AM? When it's 5:00 AM.

You gotta see this to believe it ...

When I add 15 minutes to 3:45 AM and compare that value with 4:00 AM, my
program says True. HOWEVER, When I add 15 minutes to 4:45 AM and compare
that value with 5:00 AM, my program says FALSE. This alternates with
various times ... go figure. Any suggestions would be appreciated

Here's the type of code I am using ...

Private Sub Command1_Click()
Dim tFromTime As Date
Dim tToTime As Date
tToTime = CDate(txtToTime)    ' txtToTime is 05:00 AM
tFromTime = CDate(txtFromTime)    ' txtToTime is 04:45 AM
tFromTime = DateAdd("n", 15, tFromTime)
' Both tToTime and tFromTime evaluate to 5:00:00 AM
' However, the comparison is False.
' If 04:00 AM and 03:45 AM were used then the comparison would be True.
If tFromTime = tToTime Then
    Text1 = True
Else
    Text1 = False
End If
End Sub

--
Mark Lewis
Corporate Consultants
"There are always alternatives"



Mon, 03 Apr 2000 03:00:00 GMT  
 When is 5:00 AM not 5:00 AM? When it's 5:00 AM.

Mark

Since dates are held as Doubles which are notorious for their rounding
imprecision, I can't say that I'm surprised by your findings. Worried maybe,
but NOT surprised.

Regards
{*filter*}



Tue, 04 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. New ***** Zipperhelper 1.0.176 beta ***** After 5:00 pm PST New address

2. New ***** Zipperhelper 1.0.176 beta ***** After 5:00 pm PST

3. New ***** Zipperhelper 1.0.175 beta ***** After 5:00 pm PST

4. I am trying to update a record, i am not using data control

5. I am trying to update a record, i am not using data control

6. I am learning VB.NET and am wondering....

7. up till 5am, need help bad, data control

8. Just the BASIC's ma'am.

9. I AM AN END-USER, NOT A PROGRAMMER

10. shared variable not working what am I missing?

11. Strongly Typed - what am I not catching?

12. Not very important, but I am curious

 

 
Powered by phpBB® Forum Software