How to write the if condition like if the entire column has date from apr 4 th 2023 to july 4th 2023 then the activities in then should be implemented

How to write the if condition like if the entire column has date from apr 4 th 2023 to july 4th 2023 then the activities in then should be implemented

Hi @anjani_priya

Can you share the input and expected output

or try this @anjani_priya

If
  dt.AsEnumerable().All(Function(row) DateTime.ParseExact(row(columnName).ToString(), "MMMM d yyyy", CultureInfo.InvariantCulture) >= New DateTime(2023, 4, 4) AndAlso DateTime.ParseExact(row(columnName).ToString(), "MMMM d yyyy", CultureInfo.InvariantCulture) <= New DateTime(2023, 7, 4))
Then
    ' Implement activities if all dates are within the range
    ' Your activities here
Else
    ' Activities to handle if the condition is not met
    ' Your activities here
End If

Regards

HI @anjani_priya ,
you can filter like below query but cross check the date format and apply
dt=dt.select("ColumnName<='04/04/2023' and ColumnName>='04/07/2023'").CopyToDataTable()

Regards,
Arivu

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