We help IT Professionals succeed at work.

# i need to get the time value from a decimal Value

on
Medium Priority
392 Views
for example if i have decimal value : 14.90
i need to get the time value that is : 15.30 HH.MM
how can i do it in the report ?
thanks
Comment
Watch Question

## View Solutions Only

Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Can ypu give other examples?

Generally values like that are 14 hours and .9 of an hour or 54 minutes so it it 14:54
If it really is 15.30 then what is 15.3 in your database?

mlmcc

Commented:
14.90 its 14 hours and 90 min
from the 90 min we have 1 hour + 30 min
so we have 14 + 1.30 = 15.30
this is waht i need to calc
i hope that u help me...

Commented:
Try this:
Assuming @time1 is the original time value,

floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
+
(
(
({@time1} - floor( {@time1})) * 100 -
(floor(({@time1} - floor( {@time1})) * 100/60) * 60)
)
/ 100
)

It SEEMS to work....

Commented:
in the report i made a formula whit this code :

floor(Sum ({Msam.TotalHour}),1) + floor(((Sum ({Msam.TotalHour}) - floor( Sum ({Msam.TotalHour}))) * 100 / 60))
+
(
(
(Sum ({Msam.TotalHour}) - floor( Sum ({Msam.TotalHour}))) * 100 -
(floor((Sum ({Msam.TotalHour}) - floor( Sum ({Msam.TotalHour}))) * 100/60) * 60)
)
/ 100
)
but i am geting this message :
The remaining text does not appear to be part of the formula.

Commented:
You should have cut/pasted my formula.
For one thing, you have 3 right parens on the end of your first line, where I have 2....

Commented:
Sum ({Msam.TotalHour})  in here i have the value that need to turn it to time
can u type it in youer forumla and send it here fix?
thanks ..

Commented:
Create a formula field named time1, and set its value to "Sum ({Msam.TotalHour})"
Then just use my formula.

Commented:
i creatd a formula called @time1
inside it i put this code :
Sum ({Msam.TotalHour})

what know ?
Commented:
Now, create the calculated time formula using the formula I gave you above:
floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
+
(
(
({@time1} - floor( {@time1})) * 100 -
(floor(({@time1} - floor( {@time1})) * 100/60) * 60)
)
/ 100
)

Not the solution you were looking for? Getting a personalized solution is easy.

Commented:
i need to creat a new formula ?

Commented:
i cretad n new formula call : CalcTime
and i put youer code into
then i drag the calc formula into the report
when i run the report i am geting this Exsption :

Error in formula  <@Calc>.
'floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
'
The remaining text does not appear to be part of the formula. ---> System.Runtime.InteropServices.COMException (0x80041019):
Error in formula  <@Calc>.
'floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
'
The remaining text does not appear to be part of the formula.

Commented:
someone ?
Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
Are you using Crystal or Basic syntax in your formulas?

You should use Crystal syntax.

Here is a slightly easier formula

local numbervar time1 := {@time1};

local numbervar hours1;
local numbervar minutes1;
hours1 := truncate(time1);
minutes1 := time1 - hours1;
minutes1 := minutes1 * 100;
if minutes1 >= 60 then
(
hours1 := hours1 + 1;
minutes1 := minutes1 - 60;
);
hours1 + minutes1/100

mlmcc

Commented:
A++
##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile