Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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!

1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III

Hi,

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

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

View solution in original post

3 Replies
sujeetsingh
Master III
Master III

Hi,

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

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

Not applicable
Author

see link

hope this helps you

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

jagan
Luminary Alumni
Luminary Alumni

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.