5 Replies Latest reply on Oct 5, 2018 2:36 AM by Suraj Kumar

# extract hours+minutes from decimals

Dear all,

I've been trying to calculate the hours and minutes from decimal characters, but i'm struggeling. I've searched this forum for answers, but couldn't find a solution to my issue yet..

My question:

Let's say I have a decimal of 10.90. Since time only counts to 60, this should be translated to something like 10:50. I've used the following formula:

DATEADD ('hour', SUM([calculated field]), DATEADD('minute', SUM([calculated field]), Date(NOW())))

where calculated field equals 10.90. What happens now I get returned 10:10 instead of 10:50. If I just try hour I get 10:00 and if i just try minutes i get 00:10.

How to improve this formula?

• ###### 1. Re: extract hours+minutes from decimals

Hi Flavio,

I am attaching a twbx file.

Though what i have done is converting decimal of 10.9 to 10:54

Explanation :- 10 is exactly 10 hr. and for decimal meant .9 of 60 minutes ie. 54 minutes.

If this works for you, Please check this twbx file.

Regards,

Suraj Kr.

4 of 4 people found this helpful
• ###### 2. Re: extract hours+minutes from decimals

Hi Suraj,

Thanks for the prompt reply. Unfortunately this doesn't work for me as my calculated field is a number(decimal), not a string.

I can't convert this to a string, as a calculation to get this decimal is needed.

• ###### 3. Re: extract hours+minutes from decimals

Hi Flavio,

You can keep it as numeric values and inside calculation field, convert it into string using STR string function.

Then it will sort out that problem.

Please let me know, if this helps you.

Regards,

Suraj Kr.

2 of 2 people found this helpful
• ###### 4. Re: extract hours+minutes from decimals

cheers!

• ###### 5. Re: extract hours+minutes from decimals

Glad it helped you!