I have an excel with column of date in MM/dd/yyyy format.
I need to filter list of 11 month back date from current date in Date1 column
I need result like Date2.
I have an excel with column of date in MM/dd/yyyy format.
I need to filter list of 11 month back date from current date in Date1 column
I need result like Date2.
Hi @lokeshkumar.k
To get to the date 11 months prior to Today, use Now.AddMonths(-11) and store it in a variable.
Then iterate through your datatable and convert the field into a DateTime object using DateTime.Parse or DateTime.ParseExact and do a comparison between the 2 dates.
Let me know if this helps
Thanks,
Nishant
@lokeshkumar.k
Please follow these steps.
1-Get current time.
System.DateTime.Now(“MM/dd/yyyy”)
2-Now use this to minus month
YourdateTimeDate.AddMonths(-11)
3- now loop over date column and perse datetime string to DateTime.
For this use this expression.
DateTime.ParseExact(“yourcolumnvalue”,“dd/MM/yyyy”, CultureInfo.InvariantCulture)
4- compare each value or use filter its upto you.