As working on a large application I am trying to make the datetime stamps reconcile with the current user time. so If activity id done at 3:00PM then the every user see it at 3:00PM
So Here is solution steps to the problem. on this and please correct me or lead me to the right direction if I am not on the right direction.
Store all datetime in MySql as UTC time.
Store time zones in a table with the current offset. for example
zone_id zone_name utc-offset 1 Central -6
In my users table I have a field for user_time_zone_id and in that field I will have the value "1" in the user setting so it will say that this user is using the system from "Central" location.
In my php application configuration I set the default time zone to UTC like this
date_default_timezone_set('UTC');
Once I load this application I define the user offset and on each datetime out put I do the calculation of the time. for example
date('Y-m-d', strtotime($current_offset.' hour')) where $current_offset = -6
as it is define by the user profile upon the page load.
Here are my questions.
Is my approach to this problem correct? Is there a better way of doing this? How to calculate the daylight saving time? Please keep in mind that there are some parts of the country that does not have daylight saving.