Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

INTERVAL - what does this fct return?

Hi,

I have the following scenario: In our basic data_loading script, there is a calculated field in one table

>>  interval(now() - [timestamp])  <<

I have been wondering what exactly is the value returned by this function and how it should be interpreted. I get different values of course, some like xxx:yy:ss or xxxx:yy:ss

I guess, by "manually" comparing dates and times, that the first digit is a nr. of days - but that would in some cases give me sth. like "8 days 196 hrs..." - that can't be right, can it?

All I want, actually, is to find out exactly for which items this interval is greater than 24 hrs which is the target_line.

Can anybody clarify this?

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If you don't specify a format string then you get a number back. 8.196 means 8.196 days, that's 8 days 4 hours 42 minutes 14 seconds, not 8 days and 196 hours.

Try interval(now() - [timestamp],'D hh:mm'). If all you want to know if the difference between now() and timestamp is larger than 24 hours any interval larger than 1 fits your criteria; 24 hours being 1 day.

edit: 0.196 days is a fraction of a day, just a little under a fifth of a day. 0.5 is half a day or 12 hours, 0.25 is a quarter of a day or 6 hours.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

If you don't specify a format string then you get a number back. 8.196 means 8.196 days, that's 8 days 4 hours 42 minutes 14 seconds, not 8 days and 196 hours.

Try interval(now() - [timestamp],'D hh:mm'). If all you want to know if the difference between now() and timestamp is larger than 24 hours any interval larger than 1 fits your criteria; 24 hours being 1 day.

edit: 0.196 days is a fraction of a day, just a little under a fifth of a day. 0.5 is half a day or 12 hours, 0.25 is a quarter of a day or 6 hours.


talk is cheap, supply exceeds demand
datanibbler
Champion
Champion
Author

Thanks a lot, Gysbert!

Me and a colleague were wondering a  bit about that - I still don't quite understand what that number is (what are 0.196 days?), but all I want to know is that 24hr-target_line, so that's fine.

Thanks a lot!

Best regards,

DataNibbler