Need to find whether date is falling in multiple line or not

Need to find whether date is falling in multiple line or not

Folder no. Start date. End date.

  1.                   01/01/2022. 12/31/2022
    
  2.                    01/01/2023.  5/31/2023
    
  3.                      06/01/2023.  07/31/2023
    

My input date is 07/31/2023

Since the input date comes from the 2nd and 3 Rd row
My output should be
Folder no. Start date. End date.

  1.                    01/01/2023.  5/31/2023
    
  2.                      06/01/2023.  07/31/2023
    

Scenario 2:
Folder no. Start date. End date.

  1.                   01/01/2022. 12/31/2022
    
  2.                    01/01/2023.  5/31/2023
    
  3.                      06/01/2024.  07/31/2024
    

My input date is:5/31/2023

My output should be:
Folder no. Start date. End date.

  1.                    01/01/2023.  5/31/2023
    

Scenario 3:

Folder no. Start date. End date.

  1.                   01/01/2022. 12/31/2022
    
  2.                    01/01/2023.  5/31/2023
    
  3.                      06/01/2024.  07/31/2024
    

My input date is:4/31/2023

My output should be:

Folder no. Start date. End date.

  1.                    01/01/2023.  5/31/2023
    

Scenario 4:
Folder no. Start date. End date.

  1.                   01/01/2022. 12/31/2022
    
  2.                    01/01/2023.  5/31/2023
    
  3.                      06/01/2023.  07/31/2023
    

My input date is 07/01/2023
My output should be:

Folder no. Start date. End date.

  1.                    01/01/2023.  5/31/2023
    
  2.                      06/01/2023.  07/31/2023
    

Hi,

My input date is 07/31/2023
Since the input date comes from the 2nd and 3 Rd row
My output should be
Folder no. Start date. End date.

  1.     01/01/2023.  5/31/2023
    
  2.      06/01/2023.  07/31/2023
    

are you only matching the year?

Yes based on the year how much line is there in data table

Hi,
you can use the following linq

dt.AsEnumerable().Where(Function(row) DateTime.Parse(row.Field(Of String)("Date")).Year = DateTime.Parse(dateVariable).Year).CopyToDataTable()

Change the column and variable name accordingly

Only one column is there we have start and end date column based on that only we need to check

use this linq which considers start and end date columns.

dt.AsEnumerable().Where(Function(row) DateTime.Parse(row.Field(Of String)("Start Date")).Year <= DateTime.Parse(dateVariable).Year AndAlso DateTime.Parse(dateVariable).Year <= DateTime.Parse(row.Field(Of String)("End Date")).Year).CopyToDataTable()