I want to keep the data which has "now.AddDays(-1).ToString(“d-mmm-yy”)” in Date
Hi,
Try LINQ:
DTCase.AsEnumerable.Where(Function(r) If(DateTime.TryParseExact(r("Date"),"d-mmmm-yy",System.Globalization.CultureInfo.InvariantCulture),DateTime.ParseExact(r("Date"),"d-mmmm-yy",System.Globalization.CultureInfo.InvariantCulture) = now.AddDays(-1).ToString("d-mmmm-yy"), False)).ToArray
Hi @prititit,
Sample date : Apr 5, 2020
Value = now.AddDays(-1).ToString(“MMM d, yyyy”)
Sample date : Apr 05, 2020
Value = now.AddDays(-1).ToString(“MMM dd, yyyy”)
I would suggest changing the operation to greater than or less than
First condition to use
“Date” is greater than value Now.AddDays(-2)
OR
“Date” is less than value Now
Hello @Shraddha_Gore
What if I want to get the data after last 2 days.
April 13,14,15
I tried this but its not working
Use the >=
operator
Or AddDays(-3)
As pointed out by @Pravin_Patil1 & @Adrian_Star , you’ll have to manipulate AddDays() or filter operator.
Ok, then try my LINQ.
Customize it according to your needs
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.