1

For a globally distributed application, each server might be in different timezone, the default timezone for each server could be different.

By default, I mean that the server has no idea what would be installed on the server when it's installed with php and mysql.

So, should I just work this way? To use the default timezone, let the server guy install everything in the default timezone and make sure the php and mysql have the same timezone?

I think this way is a de-coupled way so the application won't need to set timezone both on php or on mysql. All the application would be doing is to get the timezone if it needs to do something about it.

I had this concern because some application seems trying to set php or mysql timezone, even try to sync them. I am not quite sure about this. It seems complicating things.

Suggestion?

Plus:

From http://dev.mysql.com/doc/refman/5.7/en/replication-features-timezone.html

The same system time zone should be set for both master and slave. Otherwise, statements depending on the local time on the master are not replicated properly, such as statements that use the NOW() or FROM_UNIXTIME() functions.

Does this mean that my "de-coupled" way is a bad idea for master-slave settings?

Hao
  • 6,291
  • 9
  • 39
  • 88
  • 1
    I just like to always use UTC for everything. Not had any issues since that decision. – Niet the Dark Absol Oct 08 '13 at 02:19
  • I assume that you mean having UTC as the saved datetime timezone in your glabally-distributed application. It's a thought. – Hao Oct 08 '13 at 02:22
  • possible duplicate of [Daylight saving time and time zone best practices](http://stackoverflow.com/questions/2532729/daylight-saving-time-and-time-zone-best-practices) – Pekka Oct 08 '13 at 02:25
  • You can get help to your answer Here. http://serverfault.com/questions/191331/should-servers-have-their-timezone-set-to-gmt-utc – swapnil srivastava Oct 08 '13 at 02:35
  • Definitely run all your server code in UTC. Worry about what the user sees at the point when you display it, and display it in their local time. –  Oct 08 '13 at 02:42

0 Answers0