Hi @jamnanin
Can you share which items you are trying to filter, like are they columns in a data table or maybe just a list of strings?
Typically, you will need to convert your date to a DateTime type in order to compare with the current date or particular date of your choice.
Take this example for instance, where the dates are contained in a column of a DataTable:
Assign activity: dateTolerance <of DateTime> = Convert.ToDate("09/07/2017")
dt1.AsEnumerable.Where(Function(r) If(IsDate(r("Date").ToString.Trim), Convert.ToDate( r("Date").ToString.Trim ) < dateTolerance, False) ).ToArray
(( .ToArray can be replaced by .CopyToDataTable if you prefer to scrap the rest of the data, but I normally recommend .ToArray for processing items ))
So that would return all DataRows where r("Date")
is older than the dateTolerance variable. Notice, I converted the string to a date…
There are other times where Convert.ToDate() or CDate() will not work like when the month and day is in the wrong order (ie dd/MM instead of MM/dd), which in this case you would use:
DateTime.ParseExact()
So that is how you could do this if the dates are in a Table.
If the dates are in a different source, then you can use the same type of comparison, by first converting the string to a date, then using ‘<’ or ‘<=’ next to the other datetime variable; just as long as you convert both sides to a datetime type.
I hope this is more helpful.
Regards.