tags:

views:

75

answers:

2

I want to give users the option to change their timezone and display their data in that timezone. I'm currently storing a unix timestamp and would like to know what the best way to handle this conversion would be.


I am storing my timestamp in unix format. My concern is what function can I use to do the conversion on the presentation layer?

+1  A: 

Store date data as GMT, and in the user prefs let them store their timezone (which is simply an offset of GMT).

bdl
Thanks bdl. What function would I use to so the conversion back to their tz?
Jim
Some regions have daylights savings time so the offset can vary with the time of year.
mobrule
+2  A: 

Keep everything as UTC in your data store and convert at your presentation layer.

Maxwell Troy Milton King
GMT and UTC are the same thing. Pass your timestamp to date function http://php.net/manual/en/function.date.php
Maxwell Troy Milton King
Thanks Maxwell. I just found that now on PHPs site. Thanks for the help!
Jim