3 Replies Latest reply: Oct 11, 2013 3:38 AM by Quy Thanh Lê

# Delta time in decimal not working in a load

Hi,

I have some trouble to display a delta time in decimal

I have a table with an ID, a text, and 2 columns date (dateA, DateB)

I want to load this table and calculate the delta time between these 2 dates in decimal hour...

Table:

ID,

concat(text, '/') as "text",

sum(interval(DateA-DateB, 's') )as "Delta"

Resident Table GROUP BY ID;

My delta is in seconds but I can't convert it into decimal hour... When I try to put / 3600, the result is not as expected.

For example : Delta = 82500s, I should have 22.92 in Delta when I divide by 3600... But when I try to do sum(interval(DateA-DateB, 's') /3600), the result is 0.00265....

Does anyone have an idea ?

• ###### Re: Delta time in decimal not working in a load

That's because your Delta is only presenting the seconds in the text representation, while the internal data format is still representing time in fractions of days.

So you need to multiply by 24 instead of dividing by 3600!

edit:

Table:

ID,

concat(text, '/') as "text",

sum(DateA-DateB) * 24 as "Delta Hours"

Resident Table GROUP BY ID;

• ###### Re: Delta time in decimal not working in a load

You should try with

Sum(Num#(Text(interval(DateA-DateB, 's')), '#') /3600)

or

Num#(Text(Interval(Sum(Interval(DateA-DateB, 's')), 'hh')), '#')

• ###### Re: Delta time in decimal not working in a load

Perfect, thank you !