I have in a MySQL database with the column type being DateTime the following time:
Timestamp:
9:34:09
9:34:23
9:34:45
9:34:50
9:35:09
9:36:17
But a DataGridView in C# only shows me
9:34
9:34
9:34
9:34
9:35
9:36
Why?
I have in a MySQL database with the column type being DateTime the following time:
Timestamp:
9:34:09
9:34:23
9:34:45
9:34:50
9:35:09
9:36:17
But a DataGridView in C# only shows me
9:34
9:34
9:34
9:34
9:35
9:36
Why?
try to use Column.DefaultCellStyle.Format property or set it via designer....
Solved it with this code:
try
{
dataGridView1.Columns["Time_Stamp"].DefaultCellStyle.Format = "yyyy-MM-dd hh:mm:ss";
}
catch (Exception x)
{
MessageBox.Show(x.Message);
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.