Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Bendikl
Contributor II
Contributor II

Get todays data with Today()/Date(now())

Hi,

Im trying to get todays data using Date(now()), i have also atempted with Today().

I get the data date through this: timestamp(Makedate(1970,1,1)+ mid(answeredAt,7,10) /24/60/60,'DD.MM.YYYY') as WorkDate

And i need to put it in the where condition i belive like this: WHERE timestamp(Makedate(1970,1,1)+ mid(answeredAt,7,10) /24/60/60,'DD.MM.YYYY') = Date(now());

However neither with date() nor Today() seems to read it, am i missing something?

Thank you, brg,

Ben

Labels (1)
1 Solution

Accepted Solutions
Bendikl
Contributor II
Contributor II
Author

>= Today()-1, this worked to check if the date is bigger then today-1

View solution in original post

3 Replies
hic
Former Employee
Former Employee

If you want to use dates, you need to make sure that you have integers inside your date fields. For example,
   Date(Now())
will not be an integer, since Now() returns a time with millisecond precision, and Date() just formats it as a date (without removing the fractional part). But if you instead write
   Date(Floor(Now()))
or
   Today()
you will get an integer formatted as a date.

So you will need to do this also for your calculated field based on "answeredAt".

Bendikl
Contributor II
Contributor II
Author

>= Today()-1, this worked to check if the date is bigger then today-1

hic
Former Employee
Former Employee

Changing the equality test to a greater-than test is also a good solution. The point is that you cannot use equality as a condition when comparing floats.

See https://community.qlik.com/t5/Design/Rounding-Errors/ba-p/1468808