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
Title:
Best way to subtract hours, minutes, seconds from same?
Miscellaneous
Thread ID:
00394549
Message ID:
00394549
Views:
56
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.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform