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

date times days hours etc...

Status
Not open for further replies.

giggles7840

IS-IT--Management
Mar 8, 2002
219
US
ok here is an easy one. i have 2 date time fields. i need to find the difference between the 2 fields. so i create the formula FieldB - FieldA. now i want to take those results and display it in Days Hours Minutes and Seconds.

I know I have done this before but i cant remember now how i did it.

thanks,.
 
Here's my whitepaper:

faq767-3543

You'll need to add in the formula for days, I know that I've done this in other threads here, so a search might handle it as well.

Basically you'll return the difference in seconds, and then construct the display.

-k
 
I use the following to calculate how long it take to run a report.

WhilePrintingRecords;
NumberVar TotalSec := datediff("s", Datetime(DataDate,DataTime),CurrentDateTime);
NumberVar Days := Truncate (TotalSec / 86400);
NumberVar Hours := Truncate (Remainder ( TotalSec,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
NumberVar Seconds := Remainder ( TotalSec , 60);
"Total Run Time = " +
Totext ( Days, '00', 0,'') + ':'+
Totext ( Hours, '00', 0,'') + ':'+
Totext ( Minutes,'00', 0,'') + ':'+
Totext ( Seconds,'00', 0,'')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top