Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subtracting 2 time fields
Message
De
29/06/2010 17:03:59
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01471000
Message ID:
01471007
Vues:
114
This message has been marked as the solution to the initial question of the thread.
>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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform