Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pennetzdorfer
Creator III
Creator III

Interval() formatcode

Hi,

I'm using the Interval() function with the format code 'd hh:mm:ss'. The result looks like  6 11:21:33

Is there a way to get 6 days 11 h 21 min 33 sec instead?

Thanks in advance!

Regards,

Florian

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Yes, by creating a concatenated string with the single items:

=dual(

floor(Interval) &' days ' & hour(Interval) & ' h ' & minute(Interval) & ' min ' & second(Interval) & ' sec'

, Interval

)

View solution in original post

5 Replies
swuehl
MVP
MVP

Yes, by creating a concatenated string with the single items:

=dual(

floor(Interval) &' days ' & hour(Interval) & ' h ' & minute(Interval) & ' min ' & second(Interval) & ' sec'

, Interval

)

Not applicable

hi

yes like above post, use & operator for concatenate

CELAMBARASAN
Partner - Champion
Partner - Champion

There is no direct format code as of my knowledge.

May be something like this

LOAD Dual(%CustomFormat, RowNo()) AS %CustomFormat Inline [

%CustomFormat

days

h

min

sec];

=Concat(Aggr(Subfield(Interval(dateField, 'd|hh|mm|ss'), '|') & ' ' & %CustomFormat, %CustomFormat),' ',%CustomFormat)

OR

=Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 1) & ' days ' & Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 2) & ' h ' & Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 3) & ' min ' & Subfield(Interval(dateField, 'd|hh|mm|ss'), '|', 4) & ' sec'

pennetzdorfer
Creator III
Creator III
Author

Thanks! As there is no proper formatcode, swuehls approach seems to be the simplest alternative ...

Not applicable

Hi Swuehl,

Thanks for your easy wayaround to this problem.How ever I was wondering what is the need of 'Dual' here.Please explain and enlighten me.

Many thanks

Regards

Murali Krishna