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

convert seconds into hh:mm

Status
Not open for further replies.

ladyemrys

Programmer
Aug 17, 2007
44
0
0
US
Hi!

I have a database that stores payroll information in seconds. Our payroll person would like the crystal report to show hours and minutes for each employee. The SQL query we're using produces:

Badge Name Type Time (in seconds)

66666 Mephistopheles HOL 28800
66666 Mephistopheles REG 215040
66666 Mephistopheles SIC 900
66666 Mephistopheles VAC 57600

I checked out the faqs and have done this before with military time but never just straight seconds, any advice on how to do this is much appreciated. Thank you!
LE
 
So far this is working but i also need to sum them up, and converting it to text won't allow me to provide a sum of hours:

WhilePrintingRecords;
NumberVar TotalSec := {880_csv.Pay Hours};

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


Totext ( Hours , '00' ) + ':' +
Totext ( Minutes , '00' ) + ':'

Any assistance is much appreciated!
 
For anyone who might be interested, I was able to then convert the sum by group by creating the following formula in addition to the original one:


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


Totext ( Hours , '00' ) + ':' +
Totext ( Minutes , '00' )

Thanks!
 
I failed to include the most intersting part:

NumberVar TotalSec := Sum ({880_csv.Pay Hours}, {@Name});

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


Totext ( Hours , '00' ) + ':' +
Totext ( Minutes , '00' )


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top