Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subtracting 2 time fields
Message
From
29/06/2010 17:36:54
 
 
To
29/06/2010 17:03:59
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01471000
Message ID:
01471011
Views:
58
Thanks Fabio, I suspected that there were fractions of a second that were being captured, but did not know how to make visible that portion of the value.

>>I have recently run into an issue, which I've resolved, but would like to understand the why...
>>Subtracting two datetime values (where the seconds portion is always set to 00) was giving me a minute's difference...
>>t1= 2010/06/23 08:11:00
>>t2= 2010/06/23 08:15:00
>>nDiff=(t1-t2)/60
>> =-4 , but if you do a disp memo you get : Pub N -4.0000 ( -3.99999976)
>>At first I tried : nDiff=int((t1-t2)/60), which gave me -3
>>set decimals to 0 at the beginning gives the expected result.
>>
>>Can anyone explain the -4 vs ( -3.99999976) to this lost soul?
>>
>>TIA
>
>because datetime can store fraction of second,
>and conversion is not exact.
>use ROUND() when compute
>
>
>clear
>y=DATETIME()	&& HH:MM:SS,RANDOM NEAR ZERO
>z=(m.y-DTOT(DATE()))*1.000000 && show fraction
>? m.y,m.z
>RETURN
>
Previous
Reply
Map
View

Click here to load this message in the networking platform