Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time Calculation
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00142443
Message ID:
00142634
Views:
26
>Thanks for the reply Cetin. You are right, I do not need the date portion of the result - just the time in hours:minutes format. This means I need to change the result of the subtraction from seconds to TIME format. This will enable me to sum all the periods at the end of the report too. Is there a VFP function that will convert the seconds to TIME, or is there a way to tell VFP to put the reslut of subtracting two datetime fields into a TIME field?
>

The easiest way i can think of would be to first subtract the dates, then add the result to a known date at midnight. The time portion is the time since midnight - as long as the time difference between the two datetimes is one day or less, it works without further refinement.

Example:
dDateTime1 = {^ 1998/09/30 23:59}
dDateTime2 = {^ 1998/10/01 02:00}
dDateTime3 = {^ 1998/01/01 00:00} + ;
             (dDateTime2 - dDateTime1)
? HOUR(dDateTime3),MINUTE(dDateTime3),SEC(dDateTime3)
>Mon
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