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!

Converting Minutes into Hours and Minutes 1

Status
Not open for further replies.

andywing

Technical User
Nov 15, 2001
10
GB
I've searched the tek-tips archive for help with this question and found a similar question hoping to convert Minutes into Days Hours and Minutes, ie 4000 minutes = 2d, 18h, 40m

MalcomW gave a good response

ToText({{Minutes}}\(24*60),0) + 'd, ' +
ToText((({Minutes}\60) Mod 24),0) + 'h, ' +
ToText(({Minutes} Mod 60),0) + 'm'
This works in v8 - previous versions require different operators other than mod and integer division (\)

I'm running v7 and don't know how to modify this formula

Any help would be much appreciated

Andy

Andy Wing
Local Government - Systems Administrator
England
 
Try this:

whileprintingrecords;
numbervar days := Truncate ({table.field}/86400);
numbervar hours := Truncate (({table.field}-(days*86400))/3600);
numbervar minutes := Remainder ({table.field}-(days*86400),3600);
"There are "+totext(days)+" days and " +totext(hours)+ " hours and " +
totext(minutes)+" minutes in the total" Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Try using the int() and remainder() functions:

ToText(int(4000\(24*60)),0) + " days, " +
ToText(int(remainder(4000,(24*60))\60),0)+ " hours, " +
ToText(remainder(remainder(4000,(24*60)),60),0) + " minutes"


Software Support for Macola, Crystal Reports and Goldmine
dgillz@juno.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top