I have a website where users(in different timezones) can create new records in a database, and i currently have each record being recorded with a timestamp of the time it was created... I am in EST time zone, but when i view the records that i have created on the site, they show the time in MST, which also happens to be the servers time zone... When i view the records in the database, the timestamp field is not converting to utc, it is instead converting to mst... I have noticed that when i insert a record from phpmyadmin, i use the datepicker and select 18:35:01, but when i look at the record after its been inserted, it displays 15:35:01!!! This is very frustrating, and i have been reading around that timestamp fields should automatically convert to utc, which mine is not doing... Another thing is, i am currently using a date function to format the timestamp, which is displaying in 00-00-00 00:00:00 format, and that was giving me errors for a while so i started using strtotime, which may be part of the problem... Im not sure... When records are inserted into the database i am using null for the value so it will automatically use current local time... But the thing is, different people from different timezones will be creating records than people who view them... So i need to acommodate for all of that... Any suggestions as to what i am doing wrong?
You can set the timezone used by your PHP script
date_default_timezone_set('America/Los_Angeles');