I receiving dates in the USA standard format mm/dd/yy.
I can upload to MySQL only in the format of yyyy-MM-dd.
How can you convert mm/dd/yy format to yyyy-MM-dd format in C#?
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.
You could parse it and then format it. (
DateTime.ParseExact,DateTime.ToString)However, you shouldn’t have to reformat for MySQL’s benefit, and it suggests your database access is inappropriate:
DateTimevalueSo using parameterized SQL, you should just need to parse (e.g. using
DateTime.ParseExact), then pass it up as aDateTime: