Today() function in column expression

Good Day Knimers :green_heart:

I am using currently column expression to compare two date formats. But seems like it is not working correctly.

Here is my expression:

if (getDate(column("Last modified date"))==today()) {
       "1"
    }
else {"0"}

Output of getDate(column(“Last modified date”)) is:
image
2021-11-04

AND

Output of today() is image

2021-11-04.

As you can see I have same output, and the result if statement should give me 1, not 0.
But in my case it is giving zero.
What do you think, what is reason of having incorrect result?
I thought that it is because of formats, but as far as I know get Date and today should give us date format.

PS. I have only single row here
In addition, I added one more column expression with created column and it is working finely. But my purpose is not to have many nodes as possible)

last_file.knwf (22.2 KB)

Thanks in advance :innocent:

Hi @Karlygash , try to use equals() instead

if (getDate(column("Last modified date")).equals(today())) {
       "1"
    }
else {"0"}
6 Likes

Thanks a lot @bruno29a ))

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.