title: How to correctly set expiration datetime for cookies on ASP.NET Core MVC
body: <p>I'm trying to set a Cookie to the browser from back-end (Asp.Net core) which should expire on the next day same time minus 5 minutes. Here is the C# code from controller</p>
  <pre><code>HttpContext.Response.Cookies.Append(&quot;MyCookie&quot;,
         &quot;test cookie value&quot;,
         new Microsoft.AspNetCore.Http.CookieOptions
         {
               Expires = DateTimeOffset.UtcNow.AddDays(1).AddMinutes(-5)
         });
  </code></pre>
  <p>But to the browser it is coming with wrong expiration DateTime.</p>
  <p>For example if cookie expiration date was set to 2016-09-28 19:15, on the browser it will expire at 2016-09-29T17:15, and it is 2 hours less, which is weird because my time zone is +1.</p>