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!

Total minutes to display time in Hours and Minutes 1

Status
Not open for further replies.

mvalley

Technical User
Mar 4, 2011
80
US
I have a formula @totalprocmins that displays total minutes (example 79 mins)
I have been asked to convert this number into hrs and minutes so 79 would display as 1 hr and 19 mins.
I know this must be a relatively easy formula, but I have been away from Report Writing for several months I am afraid I need a refresher. Thanks in advance for any assistance. Mary
 

convert MINUTES to DAYS and then DISPLAY as TIME HH:MM

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Try:

Code:
ToText(Truncate({@totalprocmins}/60), '#') + ' Hr ' + ToText(Remainder({@totalprocmins},60),'#') + ' min'

Cheers
Pete
 
Pete..your suggestion almost has me there. Some of the conversions are displaying as - Hr -Min
examples: 90 displays as -1Hr-30min; 379 displays as -6Hr-19min.Suggestions on how I can fix this display?
 
Do not want the - in front of the Hr and the - in front of min to display...makes it look like NEGATIVE time
 
may be this
[tt]
Abs(ToText(Truncate({@totalprocmins}/60), '#')) + ' Hr ' + Abs(ToText(Remainder({@totalprocmins},60),'#')) + ' min'
[/tt]


Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Thanks for the suggestion, but with the Abs in front it returns a Crystal report Error "A Number, or currency amount is required here"on the (ToText(Truncate({@totalprocmins}/60), '#'))
 
sorry, put the Abs() function INSIDE the To_Text

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
The only way the result could show up as negative is if your formula {@totalprocmins} returns a negative result.

As suggested by Skip, the ABS() function is the best approach. Try:

Code:
ToText(Truncate(ABS({@totalprocmins})/60), '#') + ' Hr ' + ToText(Remainder(ABS({@totalprocmins}),60),'#') + ' min'


Cheers
Pete
 
That does it, thank you both for your assistance. Mary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top