title: How can I format a date for an EPiServer property rendered in a view?
body: <p>I'm working in EPiServer 7.5 with a partial view that displays news articles.  In my NewsArticle class there is a DateTime property of DateUpdated which gets set when an article is saved.  I'm able to expose this in the partial view using the PropertyFor method, like so:</p>
  
  <pre><code>@Html.PropertyFor(x =&gt; x.DateUpdated)
  </code></pre>
  
  <p>This gets rendered as:  11/19/2014 10:21:07 AM</p>
  
  <p>What I would like to do is apply special formatting to the date, so that in the above case it would display "November 19, 2014".  I tried appending .ToString() with a format to the @Html.PropertyFor(), but that did not work.  One solution that I've considered is adding another property to the NewsArticle class which formats the date, but I would prefer to format it directly in the view.  Is there a way to format this date from within the view?</p>
  
  <p>Note, I am able to do this in the view, but I'm wondering if there is a more succinct way:</p>
  
  <pre><code>@model EPiServerExercise.Models.Pages.NewsArticle
  
  @{
      string dateUpdated = Model.DateUpdated.ToString("MMMM d, yyyy");
  }
  
  &lt;div class="newsArticleDate"&gt;@dateUpdated&lt;/div&gt;
  </code></pre>
  
  <p>It just seems there should be an overload on @Html.PropertyFor, or something similar, to streamline this.  Thanks.</p>