I have an unbound DataGridView that I populate with data from an SQL database. One of the columns in the database is of type ‘datetime’.
On the load event of my winforms application, I use code below in order to format the column to only show date part of datetime column. However it shows the full datetime. I want 18/02/2020 and it’s showing 18/02/2020 00:00:00
dgv.Columns["Date"].DefaultCellStyle.Format = "dd/MM/yyyy"
dgv.Columns["Date"].ValueType = typeof(System.DateTime);
How do I format the column to only show the date portion of the datetime column?