I have a field as DateTime, I want to display only date( without time ) in my datagridview c#. I get the datetime. example: 22.03.2016 00:00:00 Any help would be appreciated. I
The problem is your column is not of type DateTime so when you apply formatting, it doesn't work.
Take a look at the method that creates the data table, you created the columns using dataTable.Columns.Add(prop.Name); which it means the DataType of column is string and formatting will not apply on column. (As I guessed previously)
Note
DataTable if you want to show it in DataGridView, it's enough to set it as DataSource of the grid.DateTime column to show only Date part, it's enough to set DefaultCellStyle.Format of that column to yyyy/MM/dd.dataTable.Columns.Add(prop.Name); with this line of code: dataTable.Columns.Add(prop.Name, prop.PropertyType); which uses data type of property as data type of column.