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!

Convert a number to minutes and seconds 1

Status
Not open for further replies.

whatisthis123

Programmer
Feb 5, 2004
5
US
I am trying to change a running total field displayed like 9.91 into 9 Minutes 55 Seconds.
 
Dear Whatisthis123,

I use this one which gives you a display formatted as a time field in the DD:HH:MM:SS format. If you want the words to print instead, just adjust the formula replacing the ":".

Try this:

Local NumberVar TotalSec :=
{@myfield};
Local NumberVar DDays :=
Truncate (TotalSec / 86400);
Local NumberVar DHours :=
Truncate (Remainder ( TotalSec,86400) / 3600);
Local NumberVar DMinutes :=
Truncate (Remainder ( TotalSec,3600) / 60);
Local NumberVar DSeconds :=
Remainder ( TotalSec , 60);

Totext ( DDays, '00', 0,'') + ':'+
Totext ( DHours, '00', 0,'') + ':'+
Totext ( DMinutes,'00', 0,'') + ':'+
Totext ( DSeconds,'00', 0,'')

That will display seconds as Days Hours Mintues Seconds.

Hope that helps,

ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top