Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

timezone between NY and London

i have 2 servsers 1 in america (NY) and 1 in europe (London)

my servers are synchronzied as close as possible. now when someone from europe go to my site it use the london server and same idea for the americas.

every now and then i do maintenance on my site, therefore i redirect the traffic to the other server. becuase of the timezone difference i need to make it transparent to the user so if a person from america is redirected to the server in london (due to maintenance) i need to show to him the EDT timezone

here my issue. i have query i run from mysql with dates (one is last date logged)

i want to display it correctly so my question is

should i use mysql to transform the date or php? which one is better and faster?

thanks

like image 904
joel Avatar asked Nov 18 '11 13:11

joel


People also ask

Is London 5 or 6 hours ahead of New York?

The time difference between London and New York is 5 hours. New York City is located in the UTC-5 time zone, during summertime it becomes UTC-4.

Is York in the same time zone as London?

Since London, United Kingdom and York, United Kingdom are in the same time zone, you can call someone during your normal hours and it will be the same time in York, United Kingdom as it is in London, United Kingdom.


1 Answers

I think the best way would be to store the last login time as an UTC-value in the DB and use PHP to convert that value to the visitor's timezone. I'd always store any timestamp data as UTC in the DB, also to avoid problems with DST and all that stuff. I think in terms of speed there is not much difference if the DB calculates the display value for you or if your PHP script does it. However since your PHP script is your presentation layer, it should take care of date formatting instead of the DB.

like image 118
Jan Thomä Avatar answered Oct 11 '22 08:10

Jan Thomä