title: Change date format in ASP.NET MVC application
body: <p>I need to change date format to be <code>dd.MM.yyyy</code>. I am getting client side validation error because ASP.NET MVC date format is different from what I expect on the server.</p>
  
  <p>In order to change ASP.NET MVC date format I tried:</p>
  
  <p>Web.config:</p>
  
  <pre><code>&lt;globalization uiCulture="ru-RU" culture="ru-RU" /&gt;
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>[DataType(DataType.Date)]
  [DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
  public DateTime? ServiceCreatedFrom { get; set; }
  </code></pre>
  
  <p>Editor template:</p>
  
  <pre><code>@model DateTime?
  @Html.TextBox(string.Empty, (Model.HasValue 
      ? Model.Value.ToString("dd.MM.yyyy")
      : string.Empty), new { @class = "date" })
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@Html.EditorFor(m =&gt; m.ServiceCreatedFrom, new { @class = "date" })
  </code></pre>
  
  <p>Even Global.asax:</p>
  
  <pre><code>public MvcApplication()
  {
      BeginRequest += (sender, args) =&gt;
          {
              var culture = new System.Globalization.CultureInfo("ru");
              Thread.CurrentThread.CurrentCulture = culture;
              Thread.CurrentThread.CurrentUICulture = culture;
          };
  }
  </code></pre>
  
  <p>Nothing worked for me.</p>