This message serves for Google indexing. It only includes the first message of each thread from technical forums. To see the entire thread, the solutions and the technical content related to each message, you need to log in by going to the main page. This can be done at http://www.universalthread.com. If you do not have an account, we encourage you to create one now and start participating in Microsoft .NET and SQL Server related technology forums, just to name a few. Our database contains nearly two millions valuable high end technical messages. Thanks for the generous contribution to everyone who participated on the site so far, including MVP, Microsoft employees and many other well known contributors. The valuable content of the Universal Thread has created a history of 16 years of high end technical content which has helped many consultants, developers and many others in the industry on a daily basis. The site also offers a subscription option that greatly enhances your site experience.


View message
From16/07/1997 12:57:37
Michael G. Emmons #005505
Apex, North Carolina, United States
To  
All


Well, since I was in a rush, I did in fact reinvent the wheel. I'm posting it here just in case anyone has need of it. The following function will accept two time strings (attained by using the TIME() fucntion) and return the hours, minutes, and seconds between the two times. It will not return days, however, since I had no use for it. So, if the difference between the two times is greater than 24 hours the result will be incorrect.

********************************************************************
Procedure TimeElapsed &&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
********************************************************************
Parameter pTimeStart,pTimeEnd
PRIVATE xBegHour,xBegMin,xBegSec,;
xEndHour,xEndMin,xEndSec,;
xHour,xMin,xSec,;
xElapsed,xError

xError = "BAD TIME DATA"

IF LEN(pTimeStart)<>8 or LEN(pTimeEnd)<>8 or ;
SUBSTR(pTimeStart,3,1)<>":" or SUBSTR(pTimeStart,6,1)<>":"
Return xError
ENDIF

xBegHour = VAL(SUBSTR(pTimeStart,1,2))
xBegMin = VAL(SUBSTR(pTimeStart,4,2))
xBegSec = VAL(SUBSTR(pTimeStart,7,2))
xEndHour = VAL(SUBSTR(pTimeEnd,1,2))
xEndMin = VAL(SUBSTR(pTimeEnd,4,2))
xEndSec = VAL(SUBSTR(pTimeEnd,7,2))

if xBegHour > xEndHour
xHour = (24 - xBegHour)+xEndHour
else
xHour = xEndHour - xBegHour
endif

if xBegMin > xEndMin
xMin = (60 - xBegMin)+xEndMin
xHour= xHour - 1
else
xMin = xEndMin - xBegMin
endif

if xBegSec > xEndSec
xSec = (60 - xBegSec)+xEndSec
if xMin = 0
xMin = 59
xHour= xHour - 1
else
xMin = xMin - 1
endif
else
xSec = xEndSec - xBegSec
endif

xElapsed = ALLTRIM(STR(xHour))+"h "+ALLTRIM(STR(xMin))+;
"m "+ALLTRIM(STR(xSec))+"s"

Return xElapsed

Michael G. Emmons
memmons@nc.rr.com