How to convert the date that have been retrieve from DB to only display d/mm/yyyy?

c#, date, sql, winforms

Solution

((DateTime)readPatient["pDOB"]).ToString("d");

For a list of supported formats see: http://msdn.microsoft.com/es-es/library/zdtaw1bw(v=vs.110).aspx

Problem

I have this `21/10/1999` value manually inserted into the SQL database and when I retrieve it like this: ``` txtDOB.Text = readPatient["pDOB"].ToString(); ``` It displays everything along with the time `12:00:00 AM`. My data type for my date column is `date`, not `datetime`. So why is it displays the time as well?

Original source