aHMAD_SQaLli Posted November 19, 2015 Share Posted November 19, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/299520-how-can-i-get-client-timezone-using-phpjs/ Share on other sites More sharing options...
Barand Posted November 19, 2015 Share Posted November 19, 2015 Javascript Date class has getTimezoneOffset() method; 1 Quote Link to comment https://forums.phpfreaks.com/topic/299520-how-can-i-get-client-timezone-using-phpjs/#findComment-1526771 Share on other sites More sharing options...
aHMAD_SQaLli Posted November 20, 2015 Author Share Posted November 20, 2015 What about time zone ? Quote Link to comment https://forums.phpfreaks.com/topic/299520-how-can-i-get-client-timezone-using-phpjs/#findComment-1526831 Share on other sites More sharing options...
Solution Psycho Posted November 20, 2015 Solution Share Posted November 20, 2015 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. 1 Quote Link to comment https://forums.phpfreaks.com/topic/299520-how-can-i-get-client-timezone-using-phpjs/#findComment-1526833 Share on other sites More sharing options...
aHMAD_SQaLli Posted November 20, 2015 Author Share Posted November 20, 2015 (edited) I get it now, Thanks you so much ! Edited November 20, 2015 by aHMAD_SQaLli Quote Link to comment https://forums.phpfreaks.com/topic/299520-how-can-i-get-client-timezone-using-phpjs/#findComment-1526835 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.