I’m working on a website that lives in multiple timezones.
My question is what is the best way to store date/time records.
My approach:
- Set PHP environment to “Europe/London” and save all data in that timezone e.g. 2011-02-11 22:00:00
- Get client timezone e.g. +8hours
- Calculate datetime + client timezone difference = 2011-02-12 06:00:00
Is that the optimal way or is there a better?
Store everything as UTC, and use the client’s regional settings to display the local date/time.