Welcome Guest, Not a member yet? Register   Sign In
Multitimezone website
#5

Because of potential differences in timezone settings between server and database, I find it's best to set the timezone in the application to UTC for these types of websites. That's what most databases default to, I believe. Then store a timezone / offset for each user, and a system wide default timezone (in case the user's haven't specified a timezone). Then you can use PHP's DateTime and DateTimeZone to display the correct time, adjusted for the user's timezone. Something like:

Code:
$date = new DateTime($originalDate, new DateTimeZone($userTimezone));
echo $date->format('...');
Reply


Messages In This Thread
Multitimezone website - by neuron - 02-25-2018, 12:31 PM
RE: Multitimezone website - by InsiteFX - 02-26-2018, 06:24 AM
RE: Multitimezone website - by neuron - 02-26-2018, 11:24 PM
RE: Multitimezone website - by InsiteFX - 02-27-2018, 04:20 AM
RE: Multitimezone website - by kilishan - 02-27-2018, 07:20 AM
RE: Multitimezone website - by neuron - 02-27-2018, 08:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB