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

Time Conversions 1

Status
Not open for further replies.
Jul 1, 2008
37
US
Hello I am having a hard time writing a formula converting times.

What I have is a field {PV_JobStep.LabourSecs} that shows how many seconds an operation should take. I need to convert that into 8 hour shifts, remainder in hours and minutes. The minutes are not showing as they should be. They show as 0. Can someone help me with my Formula? Below is what I have so far.


My Formula:

WhilePrintingRecords;
NumberVar TotalSec := {PV_JobStep.LabourSecs} ;

NumberVar Days := Truncate ( TotalSec / 28800);
NumberVar Hours := Truncate (Remainder ( TotalSec, 28800) / 3600);
NumberVar Minutes := Truncate (Remainder (days,3600)/ 60);

Totext ( Days, '####') + ' Shifts & '+
Totext ( Hours,'00') +':'+
Totext ( Minutes,'00')


Thank you,
Angie
 
Its because you are dividing days by 3600, it should ne TotalSec.

Ian
 
Yes, but if I change it to Hours i get an error saying I need another ")"

Angie
 
You have

NumberVar Minutes := Truncate (Remainder (days,3600)/ 60);

but it should be

NumberVar Minutes := Truncate (Remainder (TotalSec,3600)/ 60);

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top