How do i convert DD/MM/YYYY to YYYY-MM-DD in C#?

A

Assimalyst

Hi,

I need to convert a date from DD/MM/YYYY to YYYY-MM-DD, in order to be
able to properly query it in an sql database.

How can i go about doing this with C#?

Thanks
 
M

msnews.microsoft.com

DateTime now = DateTime.Now;
string s = now.ToString("yyyy-MM-dd");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top