Converting object to MM/dd/yyyy

this description differs from above code lines

  • above code is adding for all

an empty row to dt1

However we can take

and understand it as filter case.
Also we can extend and additional keep all rows where a non empty row(5) value cannot be parsed into a datetime

Kindly note:

  • a value like 123456 will match the isMatch
  • values like 17/12/2004 also will match the isMatch
    Both above are not dates within the format: MM/dd/yyyy HH:mm:ss

We keep in mind the following (as currently only default format were within the focus):
grafik
the quick parsing
And the quick check
grafik

Test series:
grafik

So we can setup a filter LINQ
Assign Activity:
dtFiltered =

(From d In dt_auth.AsEnumerable()
Let chk1 = isNothing(d(5)) OrElse String.IsNullOrEmpty(d(5).toString.Trim)
Let v1 = If(chk1, "01/01/0001 00:00:00",d(5).toString.Trim)
Let chk2 = DateTime.TryParse(v1, Nothing)
Let v2  = If(chk2, v1, "01/01/0001 00:00:00" )
Let dpy = DateTime.Parse(v2).Year
Where dpy < 1980 OrElse dpy > 2100
Select r = d).CopyToDataTable

and exploited that we can set all non parseable dates to the default date as default date’s year < 1980