function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kimkim 

Calculate "decimal" hours to Days Hours Minutes

I created a formula which does not seem to behave as expected.

I calculate from a number field (6,2) which hold hours values in decimal format:

by that I mean 27.50 is actually 27 hours and 30 minutes.


TEXT(FLOOR({!MyNumField} /24))&" Days "&TEXT(MOD(FLOOR({!MyNumField} ),24)) &" Hrs "
&RIGHT(TEXT(FLOOR({!MyNumField} /100*60)),2)&" Mins"

MyNumField = 48.91

This returns:

2 Days 0 Hrs 29 Mins

which is not correct, since should be 2 Days 0 Hrs 55 Mins

Now strange thing is that sometimes it does return the expected calculation.

Am probably missing something or is it a problem that I dont treat numbers as numbers here.

Thx
kimkim
Solved it....

TEXT(FLOOR({!TheNum} /24))&" Days "&TEXT(MOD(FLOOR({!TheNum} ),24)) &" Hrs "
&TEXT(FLOOR(VALUE(TEXT(VALUE(RIGHT(TEXT({!TheNum}),2))/100*60))))&" Mins"

ugly but can't see other way...

k
Jeremy Clegg 8Jeremy Clegg 8
Hi Patrick,

I am getting a compile error on this. I am trying to convert the SBT countdown in minutes into hours and minutes.

Any suggestions?