How to Convert multiple column date format in data table using linq(With out foreach)

@BalaM1510
the main building block is an array with formats:

which can be used
DateTime.ParseExact(YourDateString, arrFormats, YourCultureInfo, DateTimeStyles.None)

from your question it can be derived:

  • a column with date strings is the input for a dateTime.ParseExact
  • the conversion result will update the value within the column

LINQ could be used for this. But as we have to be prepared for conversion fails LINQ is less helfull for this due:

  • ALL or Nothing is converted
  • intransparent Issue tracing
2 Likes