Date filter, Date capture

Hi Team,

I have 2 string variables called

FromDos = “12/22/2023” and ToDos = “12/28/2023”

And also have the Datatable = in_dt_NoOfVisit

From this I have filter the dates in between FromDOS string and ToDos string

The out will be like

image

Kindly help me out.

Thanks in Advance

Hi @manikandan.murugan

Please assign the following linq to a datatable variable.

in_dt_NoOfVisit.AsEnumerable().Where(Function(row) DateTime.Parse(row.Field(Of String)("Date")) >= DateTime.ParseExact(FromDos, "MM/dd/yyyy", CultureInfo.InvariantCulture) AndAlso DateTime.Parse(row.Field(Of String)("Date")) <= DateTime.ParseExact(ToDos, "MM/dd/yyyy", CultureInfo.InvariantCulture)).CopyToDataTable()

the linq will output the datatable based on the dates in the 2 string variables.

1 Like

Hi @muktadir

Thank you so much for your help. It works

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.