title: How can I format a nullable DateTime with ToString()?
body: <p>How can I convert the nullable DateTime <strong>dt2</strong> to a formatted string?</p>
  
  <pre><code>DateTime dt = DateTime.Now;
  Console.WriteLine(dt.ToString("yyyy-MM-dd hh:mm:ss")); //works
  
  DateTime? dt2 = DateTime.Now;
  Console.WriteLine(dt2.ToString("yyyy-MM-dd hh:mm:ss")); //gives following error:
  </code></pre>
  
  <blockquote>
    <p>no overload to method ToString takes
    one argument</p>
  </blockquote>