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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
LDR
Creator II
Creator II

Comparing Time part from TimeStamp to Time value

Hi Qlikers,

I'm comparing the time I obtained from a Timestamp field to time string I converted to time format. Although in time format both values are equal, when I convert them to number, they differ.  Let me show you:

LDR_1-1664960347388.png

 

So when I try to make comparisons like:

If(Frac(Timestamp('06/09/2022 06:59:59')) <= Num(Time('06:59:59')), ... the result is false. If instead of comparing figures, I compare strings of course it works:

If(Text(Time(frac(Timestamp('06/09/2022 06:59:59')) ,'hh:mm:ss'))<= '06:59:59', ...

A different approach is to obtain the second time from a timestamp field. Then it works depending the year:

If(Frac(Timestamp('06/09/2022 06:59:59')) <=Frac(Timestamp('01/01/2000 06:59:59')), ...

I saw that for dates smaller than '01/01/1990' I'm obtaining different values.

I know that I can use what it works for me but what do you recommend me? I would prefer to continue using numbers for comparing instead of text or avoiding my last example.

Any suggestion???

Thanks for sharing 😉

 

 

 

Labels (3)
2 Solutions

Accepted Solutions
justISO
Specialist
Specialist

Hi, as this 'ending' of num format is basically not changing much, maybe round() (or even floor()) function could help to 'equalize' these times, like

round(your_time, 0.00000000001)

View solution in original post

LDR
Creator II
Creator II
Author

Hi @justISO 

Yep, I think your solution is what I needed.

Thanks

View solution in original post

2 Replies
justISO
Specialist
Specialist

Hi, as this 'ending' of num format is basically not changing much, maybe round() (or even floor()) function could help to 'equalize' these times, like

round(your_time, 0.00000000001)

LDR
Creator II
Creator II
Author

Hi @justISO 

Yep, I think your solution is what I needed.

Thanks