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?
Jump to Posttry to use Column.DefaultCellStyle.Format property or set it via designer....
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, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.