Jump to content
aHMAD_SQaLli

How can I get client timezone using PHP/JS

Recommended Posts

Hello

 

sorry if the English is not good

Is there any way to get client's timezone or hours difference using PHP and JAVASCRIPT so the time is displayed based on the client's timezone, because I've created a small PHP script and when I upload it to the server, the time was displayed based on the server's timezone.

 

Thank's in advance, Have a good day.

Share this post


Link to post
Share on other sites

The timezone offset is basically the timezone. The timezone offset is the difference from the the user's timezone and UTC time. So, you can calculate a time in the user's timezone based on the offset. But, you need to ensure the the times you are storing are in UTC time. Then, when you retrieve the time (from the database) modify it to the user's timezone.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.