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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
wanyunyang
Creator III
Creator III

Timestamp comparison

I'm trying to filter out all dates before 10/08/2018 using a where condition in the script. Something like: 

select *

from table

where timestamp((Date/(24*60*60)) + (2 + date#('1/1/1970') - date#('1/1/1900')-5/24),'MM/DD/YYYY hh:mm:ss')>='10/08/2018 00:00:00'

 

(I did -5/24 since there is a five-hour difference from database time zone).

 

However, this filters out 2019 dates as well. Any idea why?

1 Solution

Accepted Solutions
sunny_talwar

Can you try this

LOAD *
FROM table
Where (Date/(24*60*60)) + (2 + Date#('1/1/1970') - Date#('1/1/1900')-5/24) >= MakeDate(2018, 10, 08);

 

View solution in original post

6 Replies
sunny_talwar

Is this where clause within SQL SELECT script or QlikView LOAD script? If this is SQL SELECT... then this is not going to work because AFAIK Date#() is not a SQL function.
wanyunyang
Creator III
Creator III
Author

Hi Sunny,

Thanks for replying. Where clause is within Qlik Sense LOAD script.

sunny_talwar

But you have a SELECT * instead of LOAD * in your script?

wanyunyang
Creator III
Creator III
Author

Oh sorry for the confusion! I used LOAD in my script.

 

LOAD*

from table

where timestamp((Date/(24*60*60)) + (2 + date#('1/1/1970') - date#('1/1/1900')-5/24),'MM/DD/YYYY hh:mm:ss')>='10/08/2018 00:00:00'

sunny_talwar

Can you try this

LOAD *
FROM table
Where (Date/(24*60*60)) + (2 + Date#('1/1/1970') - Date#('1/1/1900')-5/24) >= MakeDate(2018, 10, 08);

 

wanyunyang
Creator III
Creator III
Author

Worked! Thank you!