Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date & Time Calculation
Message
De
26/12/1999 12:28:23
 
 
À
26/12/1999 10:50:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00308627
Message ID:
00308635
Vues:
16
>Could anyone enlighten me on which is a better way
>to calculate the differences in 2 given times?
>
>Eg: 08:30 to 17:30 how to apply a formula that
>would calculate the difference is 9 hours? Thanks

If they're stored in DateTime formats, just subtract them; the difference is the difference in seconds (there's an issue with rounding that might vary by +/-1 second; taking the INT() of the difference before assigning the value seems to be a good workaround. There's information on this in the current issue of FoxPro Advisor.) Once you have a difference in seconds, it's trivial to convert to another measure of time by simple division; if the difference is not needed for computational purposes (in which case you need a numeric value IAC) and is < 1 day, the foillowing extracts the time string:

TTOC(DTOT(DATE() + nDiffInSeconds),2)

The string returns in accordance with the current SET conditions; see the VFP docs for the effects.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform