Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to calculate elapsed time
Message
De
05/05/2006 13:54:06
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01016916
Message ID:
01119692
Vues:
19
>>>>>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'm trying to figure out a simple algorithm to convert elapsed time to this format
>367 sec.
>00:06:07
>3607 sec.
>01:00:07
>
>e.g. convert lnSeconds to hh:mm:ss
>
>I have a quite complex code doing it, but I think it could be much simpler.

I haven't yet looked at what the others have posted, but this is what I use:
FUNCTION ShowTime(m.tnElapsed)
LOCAL m.cTime,m.nHours
m.nHours = SET("HOURS")
SET HOURS TO 24
m.cTime = TTOC(DTOT(DATE(2005,01,01))+m.tnElapsed,2)
SET HOURS TO (m.nHours)
RETURN m.cTime
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform