title: Some problems using ToShortDateString() method on a nullable DateTime object, why?
body: <p>I have the following problem.</p>
  
  <p>In a class I declare:</p>
  
  <pre><code>vulnerabilityDetailsTable.AddCell(new PdfPCell(new Phrase(currentVuln.Published.ToString(), _fontNormale)) { Border = PdfPCell.NO_BORDER, Padding = 5, MinimumHeight = 30, PaddingTop = 10 });
  </code></pre>
  
  <p>and the interesting part is: <strong>currentVuln.Published.ToString()</strong>. This work fine.</p>
  
  <p><strong>Published</strong> is a <strong>DateTime</strong> property declared as <strong>nullable</strong>, in this way:</p>
  
  <pre><code>public System.DateTime? Published { get; set; }
  </code></pre>
  
  <p>The problem is that in the previous way the printed value of <strong>currentVuln.Published.ToString()</strong> is something like <strong>18/07/2014 00:00:00</strong> (also the time is included in the date).</p>
  
  <p>I want show only the date and not show the time so I tryed to use something like it:</p>
  
  <pre><code>currentVuln.Published.ToShortDateString()
  </code></pre>
  
  <p>But it don't work and I obtain the following error message in Visual Studio: </p>
  
  <blockquote>
    <p>Error 4   'System.Nullable&lt;System.DateTime&gt;' does not contain a
    definition for 'ToShortDateString' and no extension method
    'ToShortDateString' accepting a first argument of type
    'System.Nullable&lt;System.DateTime&gt;' could be found (are you missing a
    using directive or an assembly
    reference?)   C:\Develop\EarlyWarning\public\Implementazione\Ver2\PdfReport\PdfVulnerability.cs   93  101 PdfReport</p>
  </blockquote>
  
  <p>It seems that this happen because my DateTime field is nullable.</p>
  
  <p>What am i missing? How can I fix this issue?</p>