I have a data grid view that I am populating with a database as its data source. However, the columns with a date as its data type show a date and time while I only want a time.
How do I change the format of a data grid view table?
Private Sub prcDisplayTable()
dgvViewLecturers.DataSource = Nothing
dgvViewLecturers.Rows.Clear()
dgvViewLecturers.Columns.Clear()
strSQL = "SELECT * FROM Lecturers"
strTableName = "ViewLecturers"
daLecturers = New OleDb.OleDbDataAdapter(strSQL, con)
daLecturers.Fill(dsLecturers, strTableName)
dgvViewLecturers.DataSource = dsLecturers
dgvViewLecturers.DataMember = strTableName
End Sub
try this for time only format
dataGridView1.Columns("dateColumn").DefaultCellStyle.Format = "hh:mm:ss tt";