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!

How to display "90 Minutes" as "1:30" hrs??? 2

Status
Not open for further replies.

pancho13

Technical User
Apr 22, 2003
12
0
0
AU
Hello there
I've managed to change the format "1:30" into "90 minutes", so that allows me to add time with time. eg: 90 + 30 = 120 minutes... but, How to change those "120 minutes into 2:00 hrs????? how do I format "120 minutes" back to "2:00 hrs"???

Appreciate your help!!

 
totext(int({Minutes}/60),0,"")+":"+picture(totext(remainder({Minutes},60),0,''),"0")

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Thanks guys!! specially dgillz, not exactly what I was looking for, but it did help me up for a proper solution, as your one miss out some xx: 00 when the hours didn't have any minutes.

Is there any other easy way to convert this??

Thanks in advance
 
I can't see any reason why dgillz's solution shouldn't result in x:00 when you have a number perfectly divisible by 60.

Can you give us an example of when you are not getting the :00 displayed?

Naith
 
The problem was that every time that I have an "hour" figure, eg: 120 minutes, then the field displayed eg "2:0" or if I've got single minutes, eg: 5 minutes, the display was "0:5".
I come up with this solution and works wonders, for me anyway.

This is my solution:
if ((Remainder({numfieldhrs},60)= 0)) then (ToText(Truncate({numfieldhrs}/60),0,"") + ":" +
picture(ToText(Remainder({numfieldhrs},60),0,"),"),"0") )
else
if{numfieldhrs}< 10 then
(ToText(Truncate({numfieldhrs}/60),0,&quot;&quot;) + &quot;:&quot; +
picture(ToText(Remainder({numfieldhrs},60),0,&quot;),&quot;),&quot;0&quot;))
else (ToText(Truncate({numfieldhrs}/60),0,&quot;&quot;) + &quot;:&quot; +
picture(ToText(Remainder({numfieldhrs},60),0,&quot;),&quot;),&quot;&quot;))

In this way, I've managed to display, eg 0:05 minutes, or &quot;2:00&quot; hours.

Thanks everybody for your input.

Pancho13
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top