Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time Calculation
Message
From
01/10/1998 03:00:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00142443
Message ID:
00142699
Views:
34
>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?
>
>Mon

Mon,
Time field should be string, right ?
function Secs2cTime
lparameters ttEnd, ttStart
lnSecs = ttEnd - ttStart
lnHours = int(lnSecs/3600)
lnMins = int(lnSecs%3600/60) && Secs LTE 59 important ?
return padl(lnHours,2,"0")+":"+padl(lnMins,2,"0")

* Another approach - Similar to Ed's
function cDiffTime
lparameters ttEnd, ttStart
cTime1 = ttoc({1/1/1998 00:00}+(ttEnd - ttStart),2)  && secs and date setting
                                                     && determine if secs included
lnHours = floor((ttEnd - ttStart)/86400)*24+val(substr(cTime1,1,2))
return ltrim(str(lnHours))+substr(cTime1,3)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform