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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deducting date and time from another date and time!

Status
Not open for further replies.

somnia

IS-IT--Management
Apr 2, 2003
1
EU

I am trying to perform the following calculation. On a car hire form I need to calculate the length, in days and hours, of the car hire by deducting one set of date and time ('car_collected') from the return date ('date_returned'). I need to display how many days and hours the car was hired for. I've tried Trunc and Mod but not sure I am getting formula correct as weird answers returned, eg 731305.0

Any help very appreciated!!

Thanks

mike@somnia

 
Subtracting two time fields returns the elapsed time (a numeric value not a time) in hundredths of seconds.

Subtracting two date fields returns the elapsed time in days.

It gets quite complicated when the start and end times span two or more days. There's a sample of these calcs at Follow the Free Downloads link and search for Timelap.zip.

Paul Bent
Northwind IT Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top