Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Elapse time calculation if more than one day?
Message
De
31/01/2002 00:57:32
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00612649
Message ID:
00613202
Vues:
14
>I have a start time and end time and subtract start time from end time to get elapsed time. I was wondering how to make the calculation work for multiple days. I have it working for the next day, but not the day after the next day. Would I divide by 86400 to figure out how many days I have to multiple by? I would then multiply by 86400 for that number of days. Thanks for the help.
>
>Here is my code as it currently looks to handle the current day and the next day to show hours and minutes as HH:MM. Of course, I will have to change HH to HHH or add a column for days as in DDD format.

You may try this. It only needs checking whether the hospital.newdate is in the future (haven't tried this with negative number of seconds).

>
>SELECT hospital
>SCAN
>* Calculate elapsed time
>	SET DECIMALS TO 0
* since you're dealing with datetimes, the difference between two of
* them is in seconds.
	elapsed = datetime()-hospital.newdate
	sec3=int(elapsed%60)
	min3=int((elapsed/60)%60)
	hrs3=int((elapsed/3600)%24)
	days3=int(elapsed/86400)
* now build the string
>ENDSCAN
>

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform