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: 
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