Check for the Dates

Hi Guys
Im trying to compare two dates if the 2 date is not equal i will look for ±2days(iteration)
it will look for like -2,-1,1,2 in iteration
What i used to compare is
DT1.AsEnumerable().Where(Function (x) Cdate( x(“Past Date”)).Tostring(“MM/dd/yyyy”).equals (Cdate(Current_Date).toString(“MM/dd/yyyy”))).copytodatatable
Note that the Current Date is a dynamic variable
Now how should i iterate the loop to check for the + - 2 days any sugg pls


If the variable is datetime type:
You can try with CurrentDate.AddDays(1) - This 1 can be any value, in your case -2,-1,1,2

Yes the variables are datetime type
no Actually currentdate is static here for the next iteration
past date is dynamic…
If the current date is not equal to past date
I will go for the iteration which it will check into -2 to +2

ok, so you can use this function “AddDays()”. Create a loop with 4 values {“-2”,“-1”,“1”,“2”} and do a check these each of these values. If any one of combination matches exit the loop

Is possible of sharing any xaml file…so it will be helpful for me