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!

Converting a number into hours....How???

Status
Not open for further replies.

pancho13

Technical User
Apr 22, 2003
12
0
0
AU
Hello there

Could you please help me to convert back a number into hours....

As you know, Crystal report cannot add hours, eg: 13hrs + 1:30 hrs = 14:30 hrs....or in number terms...14.5 hrs

What I've done, I;ve converted the hours into a number... eg: 1:45 = 1.75...so that give me the chance to add hours and minutes as a number....but... How do I convert my end result into hours again

eg: 2.5 + 1.08 = 3.58 => 3:35 hrs

Any clues?????

Cheers from Aussie land
 
Something like this should work:

numbervar hours := truncate({@nohrs});
numbervar mins := remainder({@nohrs} * 60, 60);
totext(hours,0,"") + ":" + totext(mins,0,"");

//where {@nohrs} is your formula converting hours into a number.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top