Andy_Kemp Posted January 18, 2016 Share Posted January 18, 2016 How to automatically detect user timezone name? Like Europe/StockholmHow to automatically detect user locale? Like sv_SE Or its easier to let user to select their timezone and locale? Quote Link to comment https://forums.phpfreaks.com/topic/300498-detecting-user-locale-and-timezone/ Share on other sites More sharing options...
Jacques1 Posted January 18, 2016 Share Posted January 18, 2016 You should do both: Make an educated guess and then allow the user to override the setting. The desired language is usually specified in the Accept-Language request header. In PHP, you can get the value with $_SERVER['HTTP_ACCEPT_LANGUAGE']. The timezone can be chosen based on the IP location. Or you can use client-side scripting (again it makes sense to do both in case JavaScript is turned off). Quote Link to comment https://forums.phpfreaks.com/topic/300498-detecting-user-locale-and-timezone/#findComment-1529964 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.