CpHpristian Posted June 14, 2009 Share Posted June 14, 2009 date() gives me the server-time, right? How I can set the date for the user's local time? Link to comment https://forums.phpfreaks.com/topic/162135-timezone/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 14, 2009 Share Posted June 14, 2009 You would either need to get the user to supply you with his timezone when he registers, which you store as a setting in your user table (the way most forums do it) or if your user has javascript enabled, you can use AJAX techniques to get his timezone information to the server. If you just want to display a server's date/time value in the browser in the user's timezone, you could send the date/time value and the server's timezone to the browser and use javascript to calculate when that date/time would be in the visitor's timezone using the difference between the visitor's timezone and the server's timezone. What exactly are you trying to accomplish? Link to comment https://forums.phpfreaks.com/topic/162135-timezone/#findComment-855570 Share on other sites More sharing options...
CpHpristian Posted June 14, 2009 Author Share Posted June 14, 2009 It's for a webshop. I wanted to show the user the time he bought the item in his time zone.. not the server time zone. So I guess your second solution would work. How can I retrieve the timezone? Link to comment https://forums.phpfreaks.com/topic/162135-timezone/#findComment-855572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.