Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: int() returning wrong values from datetime operatio
Message
 
 
To
13/10/2005 10:01:54
Arlei Silva
Chevron Oronite Brasil Ltda.
Capuava, Brazil
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01058678
Message ID:
01058687
Views:
19
Use ROUND() instead of INT().
ROUND(m.DIFF_MINUTES,0)
See http://support.microsoft.com/?kbid=258998

>
>I have tried it with VFP 6, 7, 8 and 9. All versions returning the same result. Copy and Paste the following code on a new program window and then execute it.
>
>Anyone know what is happening? Or maybe this is just a bug?
>Thank you all
>
>
>
>set date british
>clear
>
>*****************************
>* Sets start and end datetime
>*****************************
>m.T_START = ctot("08/01/2005" + " " + "05:15")
>m.T_END = ctot("08/01/2005" + " " + "05:20")
>
>*****************************************
>* Find and show the difference in seconds
>*****************************************
>m.DIFF_SECONDS = m.T_END - m.T_START
>? m.DIFF_SECONDS					&& Prints 300
>
>*****************************************
>* Find and show the difference in minutes
>*****************************************
>m.DIFF_MINUTES = (m.DIFF_SECONDS / 60)
>? m.DIFF_MINUTES					&& Prints 5,0000
>
>**********************************************************
>* Now the weird thing. Shows the integer of m.DIFF_SECONDS
>**********************************************************
>? int(m.DIFF_MINUTES)					&& Prints 4 (Should be 5, not 4!!!)
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform