Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate elapse time
Message
De
29/11/1999 03:57:48
 
 
À
28/11/1999 15:48:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00296186
Message ID:
00296290
Vues:
21
Hi Claude.

>> Where I can find a function to calculate the time
between 2 dates ??? <<

As Mike and Ed have already said, you can get the number of seconds between 2 datetime values just by subtracting one from the other:

nElapsedSeconds = ABS( tDateTime1 - tDateTime2 )

I find that having the elapsed time in seconds is seldom very useful, so, here is a function that will return it for you in days, hours, minutes and seconds:
FUNCTION GetElapsedTime( tnElapsedSeconds )
LOCAL loObject

loObject = CREATEOBJECT( 'Line' )
WITH loObject
  .AddProperty( 'nDays', INT( tnElapsedSeconds / 86400 ) )
  .AddProperty( 'nHours', INT(( tnElapsedSeconds % 86400 ) / 3600 ) )
  .AddProperty( 'nMins', INT(( tnElapsedSeconds % 3600 ) / 60 ) )
  .AddProperty( 'nSecs', INT( tnElapsedSeconds % 60 ) )
ENDWITH

RETURN loObject
Marcia
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform