How to compare two dates (same year, month and date)?

Hi,

I would like to compare a date stored in the database against the date selected in the date picker. I want to check if both are the same date. Meaning same year, month and date.

The equal does not work as it is a strick comparison (year, month, date, hour, min, sec).

How to use < and > to check it is the same date?

Thanks

Why don’t you do a date subtraction, if the result is not 0 then they are not the same.

I have a date difference example on my demo app:

or in the editor;

2 Likes

Thanks, I will have a look and give a try.

Or just compare the two dates but use “formatted as dd/mm/yyyy”

2 Likes

@NigelG, I want to do that from repeating group constraints. What you suggest won’t help.

Not sure I understand, do you mean in the Repeating Group search Constraints ?

In which case you could do something like …

…with minutes and seconds changed too.

1 Like

Hi @NigelG, your suggestions worked but I don’t understand the the logic. I tested without the minutes and seconds and it seems to work. Maybe it won’t work on some cases? I really want to understand the logic. Why do I need to same for minutes and seconds?

Thanks

Does not work when I added minutes. Here is my condition:

1 Like

You would need to combine the two.

An alternative is to use an Advanced Filter…

So add the filter after the search, then scroll down and click Advanced and you can do the “formatted as”.

6 Likes