Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Elapsed Time formula

Status
Not open for further replies.

dzavad

Programmer
Apr 17, 2000
167
US
Hi, the goal is to have Elapsed Time formula of a difference (in days and hours) from the first event date time to the last event date time.
For example: Elapsed Time 30 Days, 6 hours
We have two separate fields Event_1_Date (date) and Time_of_Event_1 (string)
Note: CR10 version
The Time_of_Event_1 (string) looks like "12:01pm" in the database
but sometimes like "12:01".
Is it posible to calculate Elapsed Time in this conditions?
 
Use 'DateDiff' to turn both sets of differences into minutes - for the time, it would sometimes be negative, as when something started at 18:04 one day and finished at 11:23 the next day.

Add the two figures, with negative time subtracting. This should give you a correct total in minutes.

Now use division and remainder to turn it back into days and hours.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top