Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to subtract hours, minutes, seconds from same?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00394549
Message ID:
00394576
Views:
11
>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.


If you can't use datetime, convert everything to seconds, then back again.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform