i need to change the format of my date string using C#
from : “06/16/2010″or “16/06/2010”
to : “2010-06-16”
can you please help me achieve this
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you already have it as a
DateTime, use:See the MSDN documentation for more details. You can specify
CultureInfo.InvariantCultureto enforce the use of Western digits etc. This is more important if you’re using MMM for the month name and similar things, but it wouldn’t be a bad idea to make it explicit:If you have a string to start with, you’ll need to parse it and then reformat… of course, that means you need to know the format of the original string.