how to access HTTP header fields from WebCore app

Sorry, this is a totally wrong question. See below. :)

Others may post better replies, but in the interim, check out this blog post about Luxon. A JS library that can get you a bit further along. I believe the browser will report its timezone reliably enough, but I'd maybe avoid anything to do with referrers or IP addresses because of exactly the VPN issue you've referred to. You can't really be sure where they are located, or even if you can, they might be using a different timezone anyway so :man_shrugging:

Here's a little snippet from that post, looking at timezones. This is how TMS WEB Core determines the offset, for example:

    Function GetLocalTimeOffset : Integer;  

Basically, it is coming from the browser via JavaScript.

Dang, I just realized I wrote my whole question from the perspective of the code running on the server, not the client. SMH!

So in this case, I just want to know what day of the month it is at the client at the time they press a button or refresh the screen -- which causes a request to be sent to the server to retrieve something based on the date (eg., "fortune of the day" or something like that).

I assumed this was running on the client. But if your server doesn't need to know about the TZ details, then on the client, perhaps just get the current date/time via Now and pass that in any query to the server.

So if your server is returning a "fortune of the day", then the server might want to accept the current date/time as a parameter. In the client button-click event, the value of Now should be passed as that parameter.

Yes, that's perfect. Writing Delphi code that runs on client devices via WebCore still trips me up sometimes. I'm glad you got what I was after rather than what I was saying. :)

1 Like