fcl-web CGI AResponse.Cookie set Expires for different timezone lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- kqha · 2020-06-15 03:29 I need to implement Cookie.Expires property for my CGI app built using fcl-web. The way I set cookie expires property: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i with AResponse.Cookies.Add dobegin  Name := 'cookiename';  Value := 'cookievalue';  Expires := IncHour(Now,1);end;  The script intend to tell browser to delete cookie after one hour. The problem is, if the client are in different timezone it will become problematic. For example, if my CGI server is in GMT+2 timezone and the client is in GMT+3, the cookie will (almost) immediately expire. My immediate thought was to find the client timezone through ARequest properties and add it as consideration when setting the Expires but it seems there is no properties in ARequest to achieve it. Any idea on how to solve this? ---------------------------------------------------------------------- lucamar · 2020-06-15 04:24 IIRC (and I might not), "Expires" should be an UTC date/time and the browser (or whatever client) should convert it to local if needed. That's all. ---------------------------------------------------------------------- kqha · 2020-06-15 05:42 Quote from: lucamar on June 15, 2020, 06:24:00 amIIRC (and I might not), "Expires" should be an UTC date/time and the browser (or whatever client) should convert it to local if needed. That's all. I've tried: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Expires := IncHour(LocalTimeToUniversal(Now),1); It only set the expire timezone to GMT+0, and the resulting cookie immediately expired ---------------------------------------------------------------------- zamronypj · 2020-06-15 05:45 @lucamar is correct. According to https://tools.ietf.org/html/rfc6265#section-4.1.1 and https://tools.ietf.org/html/rfc2616#section-3.3.1 QuoteAll HTTP date/time stamps MUST be represented in Greenwich Mean Time    (GMT), without exception. For the purposes of HTTP, GMT is exactly    equal to UTC (Coordinated Universal Time). ---------------------------------------------------------------------- PascalDragon · 2020-06-15 07:08 Maybe check with the developer console of your browser what the response of your server is? This way you should be able to pin down whether it's the browser's fault or the server's...