We help IT Professionals succeed at work.

How to get client time zone to server from browser for showing based on that.

the web app runs joomla on apache server running Mysql as dB.
the server timezone is set to UTC and time values are too saved in UTC in dB.

a registered user in the site can store his events details in calendar in his account.
this details will be available to others on the site for them to interact.

 the problem is that the user recieves the details in UTC for himself and others too. even if the user gives the time zone details at the time of registration, it will become static. for eg if the user changes time zone during travel, the content will be available for the old time zone only.

if i use JS to change the content on load, there are issues related tooltip and calendar positioning as the calendar is processed by PHP not JS. so i need the user time zone value in server for PHP to process the object variable.

If there is a way using server request or some other means to sort this problem out, it will be really helpful.

thanks in advance, i guess i have not missed out anything in explaining about issue.
Watch Question

I think you want to use JavaScript to detect the user's timezone:

and then pass that to the server in the request to get the data.

The server can then use this to offset the results it results in the calendar, so there's no need to translate the resulting timestamps back into the user's timezone.



this is not complete solution but partially accepted

Explore More ContentExplore courses, solutions, and other research materials related to this topic.