Retrieving all previous dates of a given date

I have a data table in which I have all the data with a column that has dates

I want to check if all the previous dates from this month exist in this data table. For example, I input today’s date (04/20/2022) and it checks if it has 04/01/2022, 04/02/2022, 04/03/2022, 04/04/2022, 04/04/2022, 04/05/2022, etc… until 04/19/2022

The bot adds a row with the date daily. So for tomorrow it will add 04/21/2022.

In general we can check with set operation except

The date set we can create by following
arrMonthDates =
Enumerable.Range(0, now.Day).select(Function (x) now.AddDays(-x).toString(“MM/dd/yyyy”)).Reverse().toArray

I don’t want to use .now function, I want to use a variable that I can plug in with any dates such as yesterday date or before yesterday

just replace now with the variable name of your DateTime variable. It will not change or harm

1 Like