BusinessObjects Board

Format number into hour minutes

Hello all,
i have an objects that gives me a number of hours.
I want to format this into hh:mm
ex: 3.5 would give 3:30
Do someone know how can i make this ?

Thanks


BBB (BOB member since 2003-05-20)

Please try doing a search in the forum before posting. I have searched this topic for you … https://bobj-board.org/t/29182


Bharat :india: (BOB member since 2004-05-03)

Maybe this will help? It takes seconds not hours but you can just multiply hours by 3600 to make it work. This will turn your hours into a character string so should only be done at presentation so that aggregation still works. (Mm if you need the version 5 dll its in the download forum not in the thread.)


ken.gaul :uk: (BOB member since 2002-06-18)

Ureka! I had the same dilemna and after looking at couple of the posts here, my creative juices started flowing. The simplest method of converting a calcuted duration into hours and minutes (HH:MM) is:

  1. Create a variable for the initial duration calculation (e.g. Duration = DaysBetween([Receipt Dt]; CurrentDate())*24)

  2. Now for the magic, create a new variable and format the results for [Duration] accordingly (e.g. Duration HH:MM = Truncate([Duration];0) + “:” + (([Duration]-Truncate([Duration];0))*60))

BONUS: I was asked to determine the duration based on a 40 hour work week. So guess what, all ya would do is divide the Duration total by 40 (e.g. Duration = (DaysBetween([Receipt Dt]; CurrentDate())*24)/40).

Send all left over headache medicine to me. I could use it for other challenges. Enjoy. :+1:


dionicio_gonzalez (BOB member since 2005-09-26)