title: How to display current daytime in html form .net
body: <p>I have an html form that includes Time Created field, and i want to display current date and time in the form when loaded. Ive tried many .ToString() overloads and time formats and nothing seems to display the value.</p>
  <pre><code>&lt;label asp-for=&quot;TimeCreated&quot; class=&quot;control-label&quot;&gt;&lt;/label&gt;
                      &lt;input asp-for=&quot;TimeCreated&quot; class=&quot;form-control&quot; value=&quot;@{DateTime.Now.ToString(&quot;DD-MM-YYYYThh:mm&quot;);}&quot; /&gt;
                      &lt;span asp-validation-for=&quot;TimeCreated&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
  </code></pre>