Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

convert seconds in h:mm:ss

i have a field having time in Seconds, i want to convert it to h:mm:ss,

Please suggest the best approach


12 Replies
Valued Contributor III

convert seconds in h:mm:ss


this might help you.


Not applicable

convert seconds in h:mm:ss

hi Deepak,

take an example 7270 seconds, by ur formula ..


Its giving incorrect result.

take it as the exmple ,, it should give 2 hours 1 min and 10 seconds.

Honored Contributor

convert seconds in h:mm:ss

Try this one:


Not applicable

convert seconds in h:mm:ss

Hi Surender,

You have to use time() function along with hh:mm:ss format in your script.


suppose your fieldname is timeinseconds then

time(timeinseconds,'hh:mm:ss') as timeinhour



Not applicable

convert seconds in h:mm:ss

Thanks a lot Johnnes


convert seconds in h:mm:ss

Hi Sir,

what deepak said is right with a little mistake. it would be


Regards, tresesco

Not applicable

convert seconds in h:mm:ss

thnx .. dear Tresesco..

New Contributor II

convert seconds in h:mm:ss

I had to do a similar thing. I had time in seconds and needed to convert to HH:MM:SS. Tresesco's function works and should be marked as a solution to this problem. This question is currently marked as "not answered".

On the load script, I had a field called "timeinseconds". I created a new field called "hmstime". I can then do time math on this field.

num(div(timeinseconds,3600),00) & ':' & num((div(timeinseconds,60)-(div(timeinseconds,3600)*60)),00) & ':' & num(mod(timeinseconds,60),00) as hmstime

On my form I put a list box with an expression as the only field to calculate the length of the selected items.

='Duration: ' & time(sum(hmstime),'hh:mm:ss')

Tresesco's function Time(timeinseconds/3600*24),'hh:mm:ss') worked great and was simpler than my math.

New Contributor III

Re: convert seconds in h:mm:ss

Thanks..worked great.