Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 367
user3195396 Avatar asked Dec 12 '22 08:12

user3195396


1 Answers

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

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

like image 184
mnieto Avatar answered May 16 '23 04:05

mnieto