Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: int() returning wrong values from datetime operatio
Message
From
13/10/2005 12:08:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/10/2005 12:05:41
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:
01058739
Views:
37
You're welcome. One note about saying stores milliseconds. Actually not storing it as milliseconds but it's a real number keeping time as a fraction (terminology differs but result is same technically).
Cetin

>Ok Cetin,
>Thank you for your help.
>I would like to thank the other guys who have answered my question too.
>
>>>Hi all
>>>
>>>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!!!)
>>>
>>
>>It's a known thing. Datetime stores milliseconds.
>>? m.DiffSeconds / 1.000000
>>
>>m.DIFF_SECONDS = round(m.T_END - m.T_START,0)
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform