3 Replies Latest reply: Jun 12, 2013 7:46 AM by jagan mohan rao appala

# Convert seconds in decimal hour

Hi all,

I have a field in the format seconds and I need to put it in a pivot table (I have to sum hours). Convert it to hh: mm: ss is not a problem (sum (Interval (hour_field / (3600 * 24), 'hh: mm: ss')))

but I would like to convert it to decimal hours.

For example, if I have 4 hours and 30 minutes I dont want to see 4.3 but I want to see 4.5.  Is it possible?

Thanks!

• ###### Re: Convert seconds in decimal hour

Hi,

Let the field be TimeSecond then you can easily convert it as

(TimeSecond /3600) it will give you what u want

• ###### Re: Convert seconds in decimal hour

hope this helps you

http://community.qlik.com/message/324471

• ###### Re: Convert seconds in decimal hour

Hi,

Try like this

=(Hour('04:30:50') * 60 * 60 +  Minute('04:30:50') * 60 + Second('04:30:50')) / (60 * 60)

Use this in you expression or script like this

=(Hour(TimeFieldName) * 60 * 60 +  Minute(TimeFieldName) * 60 + Second(TimeFieldName)) / (60 * 60)

Hope this helps you.

Regards,

Jagan.