title: DateTime Value to null
body: <p>Hey, 
  This is kind of tough to explain because i don't even know how it is happening. 
  I have a datepicker box which when the page is loaded that date box is set to null. Once the user chooses a date and clicks the submit button - the page is reloading and working as it should fine but a time format of zeros appears with the date like so : </p>
  
  <p>5/11/2011 00:00:00 </p>
  
  <p>Is there a way i can get rid of the zeros in my post or get methods or any way possible?</p>
  
  <p>Here is how my code looks like in the aspx page:</p>
  
  <pre><code>Begin Date: &lt;%:Html.EditorFor(b =&gt; b.BeginDate)%&gt;&lt;%:Html.ValidationMessageFor(b =&gt; b.BeginDate)%&gt;
  
  End Date: &lt;%:Html.EditorFor(e =&gt; e.EndDate)%&gt;&lt;%:Html.ValidationMessageFor(e =&gt; e.EndDate)%&gt;
  </code></pre>
  
  <p>My ViewModel:</p>
  
  <pre><code>public DateTime? BeginDate { get; set; }
  
  public DateTime? EndDate { get; set; }
  </code></pre>
  
  <p><strong>This is based off of Darin's Answer:</strong></p>
  
  <p>in the ViewModel: </p>
  
  <pre><code>[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString ="{0:dd/MM/yyyy}")]
      public DateTime? BeginDate { get; set; }
  
  [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
      public DateTime? EndDate { get; set; }
  </code></pre>
  
  <p>And in my .aspx page : </p>
  
  <pre><code>Begin Date: &lt;%:Html.EditorFor(b =&gt; b.BeginDate)%&gt;&lt;%:Html.ValidationMessageFor(b =&gt; b.BeginDate)%&gt;
  
  End Date: &lt;%:Html.EditorFor(e =&gt; e.EndDate)%&gt;&lt;%:Html.ValidationMessageFor(e =&gt; e.EndDate)%&gt;
  </code></pre>