title: How to set value into HTML5 date field from Asp.Net MVC Razor?
body: <p>I found a similar question <a href="https://stackoverflow.com/questions/14423888/mvc-4-razor-adding-input-type-date">here</a> but that do not work for my case. Please look at the screen shot below. When I render data in an Edit form, all data was set to the controls properly except the highlighted date field. When I inspect the element, I found that the value is there but for some reason it is not showing in the field.  </p>
  
  <p>Here is the code I used to set value into this date field. I tried both <strong>"yyyy-MM-dd"</strong> &amp; <strong>"MM/dd/yyyy"</strong> format but none worked.</p>
  
  <pre><code>&lt;td&gt;Joining Date&lt;/td&gt;
  &lt;td&gt;
  @{
     if(Model.JoiningDate != null)
     {
        &lt;input id="txtJoiningDate" type="date" style="width: 100%;" value="@String.Format("{0:MM/dd/yyyy}",Model.JoiningDate.Value)" /&gt;
     }
     else
     {
        &lt;input id="txtJoiningDate" type="date" style="width: 100%;" /&gt;
     }
  }
  &lt;/td&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/8ZrtY.jpg" alt="enter image description here"></p>
  
  <p><strong>Edit</strong><br>
  <img src="https://i.stack.imgur.com/rURTR.jpg" alt="enter image description here"></p>