ASP.NET C# format textbox to datetime value

I have a property DOB that is of type datetime


However I need to display the datetime as a date like 31/07/1955

But currently it displays 31/07/1955 00:00:00

How can I do this so it only displays 31/07/1955 ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mugseyAuthor Commented:
Thanks but I don't have an option to to this on the property DOB that is of type datetime.

The only way I can do it is this

newClient.Dob = Convert.ToDateTime(txtDob.Text).ToShortDateString();

However I get error "cannot convert string to datetime"
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

you can use DateTime.Parse(txtDob.Text).ToShortDateString();

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mugseyAuthor Commented:
I tried that but still get string to datetime error
ok wait, are you just wanting to set the text in the control or are you trying to write it back to the db??

<< I need to display the datetime as a date like 31/07/1955>>
made me think that you just wanted to set a control with this value so

txtDob.Text = newClient.Dob.ToShortDateString("mmddyyyy")

was what i thought you were wanting.
if you just want to write back to the db the leave off the toshortdatestring();
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.