Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Time
Miscellaneous
Thread ID:
00415848
Message ID:
00415879
Views:
20
>I am looking for a function, or maybe some code to help me calculate time only, no dates. I would like to be able to store 2 different times like 8:45 and 9:03 and figure how much time went by, or say the time is 8:55, now add 10 minutes. Would I have to store these figues in a character field?
>

Convert them to datetimes and subtract; the result is in seconds. If you store your times in hh:mm:ss form, you can convert it to a datetime via:

SET DATE TO YMD
SET MARK TO '-'
SET CENTURY ON
tDateTime = EVAL('{^'+dtoc(date())+',00:09:03}')

In order to add durations, the units are in seconds. The difference between datetimes is expressed in seconds. You can extract the time portion as a string using TTOC(date time expression,2)
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
Previous
Reply
Map
View

Click here to load this message in the networking platform