Record dates within 7 days of each other

Hello friends…

I have an app that logs dates (dates of women’s menstrual cycles). How can I prevent users from saving dates that are less than 7 days apart.

Date1 - Date2 <= 7

What is the formula to use?

Thanks in advance…

Assuming the second date must be after at least 7 days from the first date you can do:

date2 - date1
formatted as hours
/ 24
> 7

1 Like

Hi there, @souadbelakhdarrb… you’ve pretty much got the answer right there in your question. Take the second date rounded down to date and subtract it from the first date rounded down to date, and when the result formatted in days is less than or equal to 7, do what you want to do.


1 Like

Thank you for your answers…
But I don’t have the dates…these dates can be anything because it comes from the users.

We must add a condition on “Only when” …
See the formula I inserted so that 2 dates are not similar…see image.

At some point you will have the dates and you will need to do something with them.
Before doing anything you can validate them with the methods mentioned before.
If they are valid you keep going with your workflow. If they are invalid you show an error message to the user.

If I understand your post at all, I think you want to put the condition at the event level, and it would probably look something like this.

Ignore the Page is loaded event, of course… it was only used to create the example.

It worked fine…Thank you very much Mikeloc.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.