dongyishen5796 2011-11-18 13:01
浏览 111
已采纳

纽约和伦敦之间的时区

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

  • 写回答

1条回答 默认 最新

  • dtby67541 2011-11-18 13:06
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?