title: How to configure model binding to get UTC DateTime via form
body: <p>When I tried to send DateTime object via form-data .NET-MVC binds it into DateTime object with the server's local timezone. 
  But in the another case DateTime object is binded correctly if it has been received via JSON.</p>
  
  <p>Using form-data
  <a href="https://i.stack.imgur.com/egzlo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/egzlo.png" alt="Using form"></a>
  Using JSON body
  <a href="https://i.stack.imgur.com/PNG9N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PNG9N.png" alt="Using JSON"></a></p>
  
  <p>a piece of Startup.cs where MvcCore is added </p>
  
  <pre><code>services.AddMvcCore(opt =&gt;
  {
      opt.ModelMetadataDetailsProviders.Add(new EmptyStringModelBinder());
  })
  .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
  .AddFormatterMappings()
  .AddCacheTagHelper()
  .AddJsonFormatters()
  .AddCors()
  .AddAuthorization();
  </code></pre>
  
  <p>The example model:</p>
  
  <pre><code>public class TestClass
  {
      public DateTime item { get; set; }
  }
  </code></pre>
  
  <p>The example controller action:</p>
  
  <pre><code>[HttpPost]
  public IActionResult TestPost([FromForm] TestClass item)
  //public IActionResult TestPost([FromBody] TestClass item)
  {
      var currentCulture = Thread.CurrentThread.CurrentCulture;
      var date = item.item;
      var UTCDate = date.ToUniversalTime();
      return Ok(UTCDate);
  }
  </code></pre>
  
  <p>There is a test project about that issue
  <a href="https://github.com/ShefardPT/TestProject/tree/DateTimeUTCFromDb" rel="nofollow noreferrer">Test project</a></p>