I want to convert particular column date value format in data table with out for each. Can anyone help me on this…?
Welcome to the Forum
you can try this way
- Do the Linq query part and take the result you will eventually use that result right.
- When you using the result do the Date Conversion part using
As my understanding you cant directly do the update part
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