Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Time format

i may be missing something pretty obvious here,

i want to display time in hours, e.g. 37.5 and a half hours will be 37:30:00 and not 13:30:00.
similar to the custom format in excel where you can put it as [ h ]:mm:ss.

also how can i show negative times. e.g. 07:00:00 - 07:30:00 = -00:30:00

Thanks

Labels (1)
1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Use interval(). Something like interval(sum(YourDurationField),'hh:mm:ss'). Time() is a clock time, so is limited to 24 hours. Interval() is a duration of time, so has no such limit. For that matter, your duration field that you're summing should be an interval as well, not a time() or timestamp().

View solution in original post

8 Replies
fernandotoledo
Partner - Specialist
Partner - Specialist

You can use the Time(Time_Value,'hh:mm:ss'). Be careful because Time_Value must be in Days, so if your field keeps hours, you should divide it by 24.

Look for it in qlik´s help under formating functions for more details.

Not applicable
Author

i have done a sample application and attached with this post. what i have done is i have inline table to enter the time. I used subfield function to separate hrs and minutes. used apply map function to recalculate minute ( cos in ur application 37.5 is 37 hrs :30 minutes. Go through the application you will understand the code.its very simple and easy application

Not applicable
Author

i may have been misleading in the original question,

the table has the time in days e.g. 0.3125 which is easy to display as 07:30:00

the problem comes when summing these. so i want 1.5625 to be displayed as 37:30:00.

in excel you can chose the format as [ h ]:mm:ss how can i do something similar in qlikview.
is this possible without having to add up the hours manually?

Not applicable
Author

i dont think there is any easy way to do it. what i would do is i will separate the value before the decimal and multiply it with 24 . then add it with time we get using time('.'& subfield(timevalue,'.',2)) ......

johnw
Champion III
Champion III

Use interval(). Something like interval(sum(YourDurationField),'hh:mm:ss'). Time() is a clock time, so is limited to 24 hours. Interval() is a duration of time, so has no such limit. For that matter, your duration field that you're summing should be an interval as well, not a time() or timestamp().

fernandotoledo
Partner - Specialist
Partner - Specialist

I didn´t know this function! Very Interesting!

Not applicable
Author

brilliant! thanks john!

doplear01
Creator
Creator

FERNANDOTOLEDO

Tu solucion fue de utilidad y me ayudo al problema similar que tenia