Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Between Two Timestamps

Hi All,

Please see below example of code that does not seem to be working correctly.

IF(Time([TIMESTAMP])>=('02:30:01') and Time([TIMESTAMP])<=('09:45:00'),'Night','Day') as SHIFT

Please assist in correcting this, for some reason all values show Day even if it conforms to the condition for Night.

Regards,

4 Replies
Anonymous
Not applicable
Author

The timestamp is in the following format YYYY/MM/DD hh:mm:ss

sunny_talwar

May be try this:

If(frac([TIMESTAMP]) >= MakeTime(2, 30, 1) and frac([TIMESTAMP]) <= MakeTime(9, 45, 0), 'Night', 'Day') as SHIFT

sunny_talwar

Or this, if TIMESTAMP is not read as timestamp:

If(frac(TimeStamp#([TIMESTAMP], 'YYYY/MM/DD hh:mm:ss')) >= MakeTime(2, 30, 1) and frac(TimeStamp#([TIMESTAMP], 'YYYY/MM/DD hh:mm:ss'))<= MakeTime(9, 45, 0), 'Night', 'Day') as SHIFT

vcanale
Partner - Creator II
Partner - Creator II

Hi,
try specifying the Time Format in your condition:
IF(Time([TIMESTAMP], 'hh:mm:ss' )>=('02:30:01') and Time([TIMESTAMP], 'hh:mm:ss')<=('09:45:00'),'Night','Day') as SHIFT