Hi Team,
How do i remove future month by keeping 9999 in the excel
for ex : current month feb so i need to remove all the future month excluding current month and 9999 in the excel sheet, please help me.
Attached is the sample screenshot
Hi Team,
How do i remove future month by keeping 9999 in the excel
for ex : current month feb so i need to remove all the future month excluding current month and 9999 in the excel sheet, please help me.
Attached is the sample screenshot
As per your requirement, please find the following query which only keeps the rows from current month & 9999.
dt.AsEnumerable.Where(Function(row) DateTime.ParseExact(row(“End Date”).ToString,“MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“yyyy”).Equals(“9999”) OR DateTime.ParseExact(row(“End Date”).ToString,“MM/dd/yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“MMMM”).Equals(Date.Now.ToString(“MMMM”))).CopyToDataTable
Please let us know if this works.
Best Regards.
Please add a break point after reading excel and please check the locals panel…to check the output variable data of excel and see the format of date…I believe the date format is different …
We can change according to the format that ypu get
Or are there any blank values in the given columns?
Mostly the date format might be MM/dd/yyyy hh:mm:ss
If you see in the above format in your locals panel then use this instead of the provided format
Cheers
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.