Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to subtract hours, minutes, seconds from same?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00394549
Message ID:
00394617
Vues:
10
>I subtract the following 2 times to get a time interval which works except when midnight rolls around and my Timea becomes less than my Timeb so Timec ends up negative.
>
>timea - timeb = timec
>
>Timea Char 8 For example hh:mm:ss
>Timeb Char 8 For example hh:mm:ss
>Timec Char 8 For example hh:mm:ss
>
>For example:
>14:30:00 - 13:15:00 = 01:15:00 or 1 hour and 15 minutes
>
>But what if Timea is after midnight?
>01:30:00 - 23:15:00 = 01:45:00 or 1 hour and 45 minutes
>
>Is there a nice and easy calculation for this? I convert the Chars to Values and multiply by each to get everything into seconds and then do my subtractions, but midnight messes up my calculations. Any ideas would be appreciated. Thanks for the help.

Just make them DATETIME data types; the result of subtracting two datetimes is the difference in seconds.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform