I’m trying to parse 4/27/2011 12:00:00 AM using M/d/yyyy H:m:s a pattern, invariant culture and default options but it doesn’t parse.
I’ll be very thankful if someone will help me to realize what’s wrong.
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.
Your pattern doesn’t include
tt, which is the AM/PM designator and is in your input text. Additionally, you wanthfor 12-hour clock rather than 24 for 24-hour clock, and it looks like you will always have two-digit minutes and seconds, so you probably just want a pattern ofM/d/yyyy h:mm:ss tt.Sample code which works:
See MSDN for more information on custom date and time format strings.