title: DateTime Format - Getting System.FormatException in c#
body: <p>I am very new to C#.. I am writing an appointment schedule program where in I want to provide Date and Time value as a string from console and then I want to parse it to <code>DateTime</code> format. But by doing so I am getting </p>
  
  <blockquote>
    <p><em>"System.FormatException" - string was not recognized as a valid datetime</em></p>
  </blockquote>
  
  <p>Here is my piece of code,</p>
  
  <pre><code>string Format = "dd/MM/yyyy hh:mm tt";
  Console.WriteLine("Enter the appointment date and time in(dd/MM/yyyy hh:mm AM/PM) format");
  User_Input = Console.ReadLine();
  Date_Time = DateTime.ParseExact(User_Input,Format,CultureInfo.InvariantCulture);
  </code></pre>
  
  <p>When I provide input exactly as format i.e like 23/11/2012 08:30 pm.. I am getting the said exception. I want to output datetime with <code>AM/PM</code>. What  have I done wrong?</p>