Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate elapse time
Message
From
29/11/1999 03:57:48
 
 
To
28/11/1999 15:48:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00296186
Message ID:
00296290
Views:
22
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
Previous
Reply
Map
View

Click here to load this message in the networking platform