Get all rows in format table if the month of a date is bigger than current month with linq

Hello all,

I have an excel file in which there is a column with dates.

I would neet to get a table with the condition that the month of the dates columns is bigger than current month using linq.

Do you know how could I do it?

Thanks! :slight_smile:

1 Like

Hey @Angel_Llull

Kindly show us the table snap to write the query ?

Thanks
#nK

Hi @Angel_Llull, I’ve used LINQ as per your requirement. Please find the below query:

InputDT.AsEnumerable().Where(Function(row) CInt(DateTime.ParseExact(row(“Date”).toString(), “dd.MM.yyyy”, Globalization.CultureInfo.InvariantCulture).ToString(“MM”))>CInt(DateTime.ParseExact(now().toString(), “MM/dd/yyyy HH:mm:ss”, Globalization.CultureInfo.InvariantCulture).ToString(“MM”))).CopyToDataTable

Let me know if it works. :slight_smile:
CheckMonthTest.zip (8.9 KB)