UTC and user Timezone


Is there an easy way to save date & time in UTC, but when displaying dates and times to have them convert to specific timezones?

I’m building an app which will be used by different users from different timezone. I think best idea would be save everything in the database in the UTC format but display as user timezone. And also what would be best approach for saving user timezone without adjusting daylight savings etc.


I’d just use unix timestamps i.e. ints and format them based on user’s saved timezone (there are tools in both Yii and PHP for that).

Thank you for the reply. So best thing would be setup mysql server timezone in UTC and it save everything in timestamp

If you’re using timestamps (stored as integers), there’s no need to touch timezone settings of MySQL at all.