AnsweredAssumed Answered

Converting minutes to D:H:M

Question asked by PaulWebb on Mar 9, 2014
Latest reply on Mar 12, 2014 by disabled_winfried

I came up with the below and it works. Just wanted to see if there is a better/shorter way to write it and if there are any gotchas I might be missing. Thanks for looking. The goal is to convert minutes to D:H:M.

 

examples

72 minutes = 1:12

1827 minutes = 1:06:27

// DAYS SECTION //////////////////////////////////

 

Case (
Int ( ( SR::INITIAL_RESPONSE_MIN / 60 ) / 24 ) < 1 ; "" ;
Int ( ( SR::INITIAL_RESPONSE_MIN / 60 ) / 24 ) & GetAsText ( ":" ) )

 

//////////////////////////////////////////////////////

 

&

 

// HOURS SECTION //////////////////////////////////

 

Case (
Int ( ( ( ( SR::INITIAL_RESPONSE_MIN / 60 ) / 24 ) - Int ( ( SR::INITIAL_RESPONSE_MIN / 60 ) / 24 ) ) * 24 ) < 10 ; 0 ; "" ) &
Int ( ( ( ( SR::INITIAL_RESPONSE_MIN / 60 ) / 24 ) - Int ( ( SR::INITIAL_RESPONSE_MIN / 60 ) / 24 ) ) * 24 )

 

& ":" &

 

//////////////////////////////////////////////////////

 

// MINUTES SECTION //////////////////////////////////

 

Case (

 

Round ( ( ( ( SR::INITIAL_RESPONSE_MIN / 60 ) - Int ( ( SR::INITIAL_RESPONSE_MIN / 60 ) ) ) * 60 ) ; 1 ) < 10 ; "0" ; "" ) &
Round ( ( ( ( SR::INITIAL_RESPONSE_MIN / 60 ) - Int ( ( SR::INITIAL_RESPONSE_MIN / 60 ) ) ) * 60 ) ; 1 )

 

//////////////////////////////////////////////////////

Outcomes