Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Show time as hh:mm:ss format

Suppose I have a [Time]: 164551 seconds. I want it to show with hh:mm:ss format.

I tried two ways, but neither worked.

1. If I put my function as [Time], choose number formatting as Duration and format pattern as h:mm:ss, then it shows as 3949224:00:00, which is the wrong result.

1.PNG

2.PNG

2. If I put my function as time([Time],'hh:mm:ss'), the result also shows as 3949224:00:00.

What's wrong with these two methods? What should I do?

Thanks in advance!

1 Solution

Accepted Solutions
JustinDallas
Specialist III
Specialist III

Maybe someone else will come with a more meaningful response.  You may want to forgo using the format in the UI, and try formatting it in the dimension.

Try something like this:

Data:

TestData:

LOAD * Inline

[

'UserId',  'seconds'

    1,  164551

]

;

EXIT Script

;

UI;

=Interval(seconds/86400,'h:mm:ss')

Time1.PNG

On another note, I'm not sure why my original attempt at Time(Time#(seconds,'s'),'hh:mm ss') didn't work and gave me the wrong answer.

Hope this helps.

View solution in original post

8 Replies
sunny_talwar

Try this

Time(Time#([Time], 'ss'),'hh:mm:ss')

JustinDallas
Specialist III
Specialist III

Maybe someone else will come with a more meaningful response.  You may want to forgo using the format in the UI, and try formatting it in the dimension.

Try something like this:

Data:

TestData:

LOAD * Inline

[

'UserId',  'seconds'

    1,  164551

]

;

EXIT Script

;

UI;

=Interval(seconds/86400,'h:mm:ss')

Time1.PNG

On another note, I'm not sure why my original attempt at Time(Time#(seconds,'s'),'hh:mm ss') didn't work and gave me the wrong answer.

Hope this helps.

wanyunyang
Creator III
Creator III
Author

Thanks for help!

I tried with Time(Time#([Time], 'ss'),'hh:mm:ss') and number formatting: Auto. The result was 21:42:31, which I don't think matches 164551 seconds?

JustinDallas
Specialist III
Specialist III

Hello Sunny,

For some reason, this gives the wrong answer, it gives 21 hours and some change.  I'm not quite sure why this doesn't work.

sunny_talwar

Do you mean seeing 21:42:31 instead of 45:42:31? I guess time function only shows time and skips the day... May be this

=Interval(Interval#(164551, 's'), 'hh:mm:ss')

sunny_talwar

Try this or what Justin gave

=Interval(Interval#(164551, 's'), 'hh:mm:ss')

wanyunyang
Creator III
Creator III
Author

Thank you very much!

wanyunyang
Creator III
Creator III
Author

Thank you very much!