0

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?

Edited by riahc3

3
Contributors
3
Replies
19
Views
3 Years
Discussion Span
Last Post by riahc3
3

try to use Column.DefaultCellStyle.Format property or set it via designer....

Edited by Daemon_CC: improvement

0

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);
            }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.