detail.ColumnD
is probably a DateTime
type. DateTime
has no format. You format a DateTime
when you convert it to a string. So after you've done:
detail.ColumnD = reader.GetDateTime(8);
Do:
Console.WriteLine("ColumnD: "+detail.columnD.ToString("dd-MM-yyyy"));
This will allow you to see the difference. So anywhere you want to actually display detail.ColumnD
in the UI, convert it to a string and pass in the necessary format string. For example, see below.
DateTime dt=DateTime.Now;
TextBox tb=new TextBox();
tb.Text=dt.ToString("dd-MM-yyyy");
For those that find this question via a web search, you can change the date format to any other valid format string. There are several pre-defined ones or you can do custom ones. See Custom Date And Time Format Strings in MSDN Documentation.
For a deeper understanding, the DateTime object actually just stores the number of ticks (100 nanosecond units) since midnight on January 1st of 0001 Common Era. DateTime has convenience methods that understand how to convert from a string (Parse or TryParse) or to a string. See DateTime documentation in MSDN for more details.