suresh64633 Posted December 29, 2009 Share Posted December 29, 2009 Hi I want to display time as per client locations. And for this i need client Time Zone to set through date_default_timezone_set() function. OR any one having another way will be appreciated. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/186567-how-do-i-get-timezone/ Share on other sites More sharing options...
cags Posted December 29, 2009 Share Posted December 29, 2009 There is no direct way of knowing the TimeZone of a visitor with PHP alone as it is server side technology and the TimeZone is not one of the headers sent by the browser. There are various ways (API's etc.) or approximating a TimeZone based on the visitors IP (which obviously you do have access to), alternatively displaying the time with JavaScript which will use the visitors local settings might be an option. The most common method employed is probably to simply allow the user to store their location (as with this forum). Quote Link to comment https://forums.phpfreaks.com/topic/186567-how-do-i-get-timezone/#findComment-985352 Share on other sites More sharing options...
ignace Posted December 29, 2009 Share Posted December 29, 2009 You could also consider Ajax to submit the local settings to PHP and store them in _SESSION or _COOKIE Quote Link to comment https://forums.phpfreaks.com/topic/186567-how-do-i-get-timezone/#findComment-985368 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.