My string contains the value: 08/20/2012-10.32.19
I want the output in string datatype itself as 08/20/2012 10:32:19 [format is MM/dd/yyyy HH:mm:ss].
Please help!!
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 may convert the string to
DateTimeand then use.ToString()with the required format.Test will have
EDIT: based on the comment
You may specify multiple date formats and then parse accordingly.
Or in a single line
This will satisfy your both case of dates: