I am sending in a strings in with the date part, hour part and minute part and AM/PM Now I want to make this into a DateTime. But I am unsure how to change the time part to AM/PM depending on user choice.
How do I do this?
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 initialize the time with the date/hour/minute and then add 12 hours if it is PM. Alternatively, you could format the string with the am/pm and convert that to a datetime. I’ll see if I can find an example using am/pm.
EDIT:
Plenty of documentation in MSDN including a C# example for “2/16/2008 12:15:12 PM”.