In my datagridview1, the DATE column show format "MM/dd/yyyy hh:mm:ss"
Then I use this code.
I use a function to fill a datagridview like this
public void load_table()
{
DataTable ltdgv = getLoad_table();
//the getLoad_table() function return a datatable type and store it to ltdgv
foreach (DataRow dr in ltdgv.Rows)
{
dr["DATE"] = DateTime.Parse((dr["DATE"].ToString())).ToShortDateString();
}
dataGridView1.DataSource = ltdgv;
}
but the DATE column still showing format MM/dd/yyyy [ex: 11/27/2016]
but I want to change it to dd/MM/yyyy or 27/11/2016
I tried to change it into =
dr["DATE"] = DateTime.Parse((dr["DATE"].ToString("dd/MM/yyyy"))).ToShortDateString();
// I fill a parameter to the .ToString()
But I now get a "syntax error".
So, how to fix this?