Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subtracting 2 time fields
Message
 
À
29/06/2010 17:03:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01471000
Message ID:
01471011
Vues:
57
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
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform