I have a .NET DataTable with a column of type DateTime. I would like to format the date into Month, Year using the “y” format specifier.
I would prefer not having to iterate through all the rows/columns changing the value.
What is the best way to do it?
I have a .NET DataTable with a column of type DateTime. I would like
Share
DataTablejust stores values. It does not provide formatting. Either formatDateTimebefore putting it toDataTable(thus store it as a string), or do formatting on control, which yourDataTableis bound to (e.g.DataGridViewhasFormatproperty for cell style).