Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to calculate elapsed time
Message
From
25/05/2005 08:24:48
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01016916
Message ID:
01017469
Views:
16
>>>>>>Wow <g>. I didn't even think of that. I need to learn to find simple solutions myself and not to bother people with my silly questions.
>>>>>>Thank you very much.
>>>>>
>>>>>Don't worry, there is no problem to ask if you don't know something.
>>>>>
>>>>>BTW, if you want to format the difference so that it also appears as a DateTime value, you might add it to a midnight DT value. The date part, of course, would be irrelevant.
>>>>
>>>>No, I need the result in seconds (actually in hours which is easy to convert).
>>>>Thank you very much.
>>>
>>>What's to convert?
>>>
>>>cTime = TTOC({^2005/01/01 00:00}+nSeconds,2)
>>>
>>>Take whatever portion of it you need with LEFT() or SUBSTR().
>>
>>Fred,
>>
>>I am no sure I understand your suggestion. I was looking for a way to find difference between two T-type values in hours. Hilmar's suggestion works very well. But I don't see how the method you show will help me. What am I missing?
>>
>>Thank you for your suggestion.
>
>Once you get the difference between the two datetime type values, you have seconds. To convert the seconds to time format, use what I posted above.
>
>t1 = DATETIME()
>*
>* wait some amount
>*
>t2 = DATETIME()
>
>nSeconds = t2 - t1
>cTime = TTOC({^2005/01/01 00:00}+nSeconds,2)

Fred and Cetin,

Now I understand what you guys were suggesting. I probably didn't put my question correctly, initially. What I wanted is simply the difference between two times in hours, in a numeric format. Like using it as a stop watch. For example, if I start a process at 10 pm and finish it at 1:30 am next day, I need to know that the elapsed time is 3.5 hours. And I understand that the subtracting one DateTime type from another will take into account the date change and will give me 12600 seconds.

Thank you for the explanation and your help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform