Comparing Dates in Data Table

Hi All,

I am trying to extract max value of date from Data Table and then comparing with the current row row date. If both the dates are equal then I am clicking the max date. Even though after comparing I am getting the dates equal(output using write line) but in my case its going to else part saying dates are not matched . I have tried using Trim at the ned of both the sides.



max_date=ExtractDataTable_Invoice.AsEnumerable.Where(Function(r) DateTime.TryParseExact(r(“Date”).ToString,“M/d/yyyy”,System.Globalization.CultureInfo.InvariantCulture,DateTimestyles.None,New DateTime)).Max(Function(r) DateTime.ParseExact(r(“Date”).ToString,“M/d/yyyy”,System.Globalization.CultureInfo.InvariantCulture,DateTimestyles.None)).ToString(“M/d/yyyy”)


Hello @dutta.marina try below
CurrentRow("DATE").ToString = max_date
You should never put your variables in quotes.
Because of quotes, condition was matching strings "03/31/2022"="max_date" which never going to match hence will always go into else.

Thanks @AkshaySandhu .It worked

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